Magento Forum

How to get attribute name from attribute id
 
Rinku
Member
 
Total Posts:  41
Joined:  2008-09-17
New Delhi
 

Hi All,

I made a attribute with the name “Language”. I attached it with products. Now the language is showing in the form of 1,2 (means id of the languages that I add as an option). Now I want the name of the language from this id. How can I do it?

thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
somesid
Sr. Member
 
Total Posts:  83
Joined:  2008-06-20
 

You are probably looking for this :

<?php echo $_product->getAttributeText('your_attribute')?>

If you are on the product view page you can use the function directly, on the product list page see here :  http://www.magentocommerce.com/wiki/how-to/add-attributes-to-product-grid

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mohal
Jr. Member
 
Total Posts:  20
Joined:  2012-04-08
 
somesid - 21 September 2008 10:52 PM

You are probably looking for this :

<?php echo $_product->getAttributeText('your_attribute')?>

If you are on the product view page you can use the function directly, on the product list page see here :  http://www.magentocommerce.com/wiki/how-to/add-attributes-to-product-grid

Hi!

I only have ID of the attribute. Your provided solution doesn’t work. Can you help me with it?

Regards!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mohal
Jr. Member
 
Total Posts:  20
Joined:  2012-04-08
 

This is helpful if one has only ID of the attribute.

$attribute1 Mage::getModel('catalog/resource_eav_attribute')->load(549); // 549 is the ID of the attribute.
$attribute1_name $product->getAttributeText ($attribute1->getName ());
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top