B-219 Sec-55 Noida, India

Return Product Attributes

// The following returns the option IDs for an
//attribute that is a multiple-select field:

$_product->getData('color'); // i.e. 456,499
// The following returns the attribute object,
//and instance of Mage_Catalog_Model_Resource_Eav_Attribute:

// instance of Mage_Catalog_Model_Resource_Eav_Attribute
// The following returns an array of
//the text values for the attribute:

// Array([0]=>'red', [1]=>'green')
// The following returns the text for the attribute
if ($attr = $_product->getResource()->getAttribute('color')):
echo $attr->getFrontend()->getValue($_product); 
// will display: red, green
(Visited 30 times, 1 visits today)

Leave a reply

You must be logged in to post a comment.