I'm trying to get custom product attribute value (for attribute code flr01) in catalog_product_save_after observer without loading the product but I'm gettin null value if I'm not loading the product before using following functions

$qty = $observer->getProduct()->getAttributeText('flr01');


$qty = $observer->getProduct()->getData('flr01');

While loading the product before using getData() method, I'm getting flr01 value

$productId = $observer->getProduct()->getId();
$product = Mage::getSingleton('catalog/product')->load($productId);
$qty = $product->getData('flr01');

I think loading the product again is not recommended from performance point of view (I should already have all product attributes available in $observer->getProduct() ).

  • 1
    have you try this: $product->getResource()->getAttribute($attribute_code)->getFrontend()->getValue($product); – Amit Bera Jul 22 '15 at 6:02

You can get custom attribute data using below code at observer


and for getting : text value if it dropdown.


To retrieve a single attribute directly from the database, you can use

$flr01 = $product->getResource()->getAttributeRawValue(

If you need multiple attributes, you can also pass an array of attribute codes instead of a single attribute code, then the result is an array in the form [attribute_code => attribute_value].


$attributes = $product->getResource()->getAttributeRawValue(
    ['flr01', 'flr02', 'flr03'],

// Now you have the values in:

Note that this will return you the raw value, i.e. if the attribute is not a simple text field attribute, but uses a dropdown, multiselect or a custom backend model, the attribute->getFrontend() method described by @Amit Bera will give you the formatted value as it gets displayed.

  • Can you give one example of fetching multiple attributes using above method? say flr01, flr02,flr03. – amitshree Jul 22 '15 at 8:27
  • See example in updated answer – Fabian Schmengler Jul 22 '15 at 8:30

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.