To show the custom attribute label and value in a magento cart we do the following
suppose attribute_code is myvar
it's ID/VALUE is 7 and LABEL = Myvar
create config.xml of module with the following code
<global>
<sales>
<quote>
<item>
<product_attributes>
<section/>
</product_attributes>
</item>
</quote>
</sales>
And in cart.phtml
$_item->getProduct()->getSection();
This code will return ID/VALUE of attribute 7
by using this value we will get the label as
$_product = Mage::getModel('catalog/product');
$attr = $_product->getResource()->getAttribute("myvar");
if ($attr->usesSource()) {
$_label = $attr->getSource()->getOptionText("7");
}
0 Comment(s)