2

I have added a custom attribute "flag" to the product. But when I try to access the data using $product->getData('flag');. Its returning null.

I find some way to load custom attribute in the stackexchange by calling raw attribute function.

But when I checked the product object it contain about 43 attributes, includes name, id, thumbnail, type_id etc., so is there a way to configure magento to collect my custom attribute also when it loads other 43 attributes.

  • Are you calling the attribute in the product page or in the list page? – mbalparda Jul 6 '15 at 14:21
  • I am calling this attribute from price.phtml. its under catalog/product. – ted Jul 6 '15 at 14:27
  • Have you tried $product->getFlag()? – mbalparda Jul 6 '15 at 14:33
  • Yes its not working.. 'flag' was not part of the 'data' inside product. – ted Jul 6 '15 at 14:34
  • Have you tried flushing cache and rebuilding indexes? Are you sure the product you are using to test has a value set for the new attribute? – mbalparda Jul 6 '15 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.