Magento 1.9 Custom Attribute Value – Dropdown Input Type

custom-attributesmagento-1.9

I have created a custom attribute (color_materials) in Magento admin, which input type is set to dropdown. I'm trying to get this attribute value programatically, and I have the following code.

$product = Mage::getModel('catalog/product')->loadByAttribute('sku',$this->getSku($_item));
$productOption = $product->getData('color_materials');

The output i got is a number, which is stored in catalog_product_entity_int. But I want to get it's associated text, not a number. How can I achieve this?

Best Answer

use getAttributeText

 $product = Mage::getModel('catalog/product')->loadByAttribute('sku',$this->getSku($_item));
 $productOption = $product->getAttributeText('color_materials');