How to Get Product Attribute Value in Magento?

In order to get product attribute value in Magento one needs to follow the below given code for getting desired value in the specific category. This method can be applied without loading the whole product.


$attribute_option_id = Mage::getResourceModel('catalog/product')->
getAttributeRawValue($productId, 'my_attribute', $storeId);
$product = Mage::getModel('catalog/product')
    ->setStoreId($storeId)
    ->setData('my_attribute', $attribute_option_id);

$text = $product->getAttributeText('my_attribute');

With this code the current Magento product attribute value will be the desired result.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *