Monday, July 8, 2013

Get Customized Attribute in Shopping Cart

As it is a per item attribute, you need to go to your template (say you are using the modern template), modify the file /app/design/frontend/default/modern/template/checkout/cart/item/default.phtml.   

If there is no such file, copy from /app/design/frontend/base/default/template/checkout/cart/item/default.html.

Assume you created an attribute free_shipping which is a Yes/No field and you want to display an icon if the free_shipping is Yes.

$_item = $this->getItem();
$productId = $_item->getProductId();
$_product = Mage::getModel('catalog/product')->load($productId);
$freeShipping = $_product->getData('free_shipping'); 

Remaining task is just to add the if...then...else block to show the icon.