Anybody knows how to get Attribute Code of configurable product by its frontend label?

I've tried this

Mage::getModel('eav/entity_attribute')->getCollection()->addFieldToFilter('frontend_label', 'Foo'); 

But have no idea how to get the attribute code.


Hello Please try below code...

$attr = Mage::getModel('eav/entity_attribute')->getCollection()->addFieldToFilter('frontend_label', 'Color');

echo $attr->getData('attribute_code');
  • Hello, thank you. I achieve it like this $attribute = $attr->getData('attribute_code'); echo $attribute[0]['attribute_code']
    – Wakanina
    Feb 2 '14 at 9:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.