B-219 Sec-55 Noida, India
+918010221733

Return Product Attributes

<?php
$_product->getThisattribute();
$_product->getAttributeText('thisattribute');
$_product->getResource()->getAttribute('thisattribute')
->getFrontend()->getValue($_product);
$_product->getData('thisattribute');
// 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:

$_product->getResource()->getAttribute('color');
// instance of Mage_Catalog_Model_Resource_Eav_Attribute
// The following returns an array of
//the text values for the attribute:

$_product->getAttributeText('color');
// 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
endif;
?>
(Visited 31 times, 1 visits today)

Leave a reply

You must be logged in to post a comment.