Magento News
Magento: Get Attribute Id from Option Id
I am working on a module, and ran into a problem where I needed to be able to get the frontend name of an attribute, while only having the option id for one of the many options of an attribute (dropdown or multiselect). Getting this turned out to be easier than I thought:
$_attributeId = Mage::getModel('eav/entity_attribute_option')->load($optionId)->getAttributeId(); $_attribute = Mage::getModel('eav/entity_attribute')->load($_attrId); echo $attribute->getFrontendLabel();
The above code gets the attribute id for the particular option. Then it loads up the attribute model for that particular attribute, and gives you access to any of the available data, allowing you to call the getFrontendLabel() method to get the attribute name.
Magento: Get Attribute Id from Option Id
Possibly Related Posts:
- Database query different results
- Menu highlight in magento under admin
- magento disable a banner on certain category pages or have a banner with multiple links
- Magento, using ACL for frontend. Possible?
- Magento IE-7 Fix In Windows XP
RSS Feed