Tuesday, 6 December 2011

Access a text and dropdown attribute value in Magento

$_product = Mage::getModel('catalog/product')->load($productId);

//Assume you like to access a text field named "test"

echo $_product->getTest();

//Assume you like to access a dropdown field named "test"

echo $_product->getAttributeText('test');

//Assume you like to access a multiselect dropdown field named "test"

echo (is_array($_product->getAttributeText('applications')))?implode(", ",$_product->getAttributeText('applications')) : $_product->getAttributeText('applications');

// In case of single item select it returns text else in case of multi select it return array so checking the return value type is necessary.

//to get all selected values for this product comma separated as string


  1. Strongly suggest adding a "google+" button for the blog!

  2. I was honored to obtain a call coming from a friend as he uncovered the important points shared on your own site. Browsing your blog publication is a real wonderful experience. Many thanks for thinking of readers much like me, and I would like for you the best of achievements as being a professional in this field.