Magento – How to Get Yes/No Attribute Value

magento-1.7magento-1.8magento-1.9

I added an attribute test through admin panel, which can be set to yes/no value. I want to display the value of test whether it is set to yes or no. How can I do that?

I tried something like that:

<?php
 $attributeModel = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product','test');
 echo $attribute_value = $attributeModel->getStoreLabel($storeId);
 $_product = Mage::getModel('catalog/product')->load($productId);
 echo $_product->getData('test');
?>

Best Answer

Try This

echo $_product->getAttributeText('test');
Related Topic