Wednesday, 20 June 2012

How to get Dropdown Attribute value

In Magento it is possible to access a product’s attributes with a simple getter method. Let’s get the attribute test:

<?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?> 

This works as long as test is an attribute of type ‘text’. If the attribute is a dropdown, the method will just return the id of the selected option. To get the dropdown text, you need to call another method:--

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



No comments: