Wednesday 22 June 2011

Display All Product Attribute in Mageto Shopping Cart

Open the location given below
note: path can differ according to templete

app\design\frontend\base\default\template\checkout\cart\item\default.phtml


use the Code below in default.phtml.

<?php
     $product = Mage::getModel('catalog/product')->load($this->getProduct()->getId());
    $attributes = $product->getAttributes();
   
    foreach ($attributes as $attribute) {
        if ($attribute->getIsVisibleOnFront() && $attribute->getIsUserDefined()) {
            $value = $attribute->getFrontend()->getValue($product);
            if (strlen($value) && $product->hasData($attribute->getAttributeCode())) {
                $data[$attribute->getAttributeCode()] = array(
                    'label' => $attribute->getFrontend()->getLabel(),
                    'value' => $value //$product->getData($attribute->getAttributeCode())
                );
?>
    <span style="font-weight:bold;"><?php echo $data[$attribute->getAttributeCode()]['label']; ?></span>: <span><?php echo $data[$attribute->getAttributeCode()]['value']; ?></span>
<?php
            }
        }
    }
?>

No comments:

Post a Comment