PUBLISHED: Dec 31, 2011 1 min read

Getting the Text Value of a Category Attribute of Type Select

Tom DiDomenico

Tom DiDomenico

Senior Vice President, Digital Strategy & Technology

As shown elsewhere, you can add an attribute to the category entity in Magento.  If the attribute is of type select, getting the text value of an option is a bit of a pain:

$category = Mage::getModel(‘catalog/category’)->load(10);

$attribute = Mage::getSingleton('eav/config')->getAttribute('catalog_category', 'myattribute_code');

$text = $attribute->getSource()->getOptionText($category->getMyattributeCode());