Hot Topics

Magento – Database Queries

Magento is a complete and awesome MVC application. It’s fully moduler and easy to extend its features and functionality. All…..

Magento – get Attribute details by attribute code

In magento attribute is a very important part of the catalog structure. Many a time we need to get some other details of the attribute, for example frontend label or attribute id or the attribute frontend type.

This code returns all the details of the product attribute using the attribute code
// use your own attribute code here
$attribute_code = "color";
$attribute_details = Mage::getSingleton("eav/config")->getAttribute('catalog_product', $attribute_code);
$attribute = $attribute_details->getData(); // returns array
// use $attribute['code']; etc.