This code is for counting the total number to products in the cart having specific attribute code.
$items =Mage::getModel('checkout/cart')->getQuote()->getAllItems();
$attriubtecnt=0;
foreach($items as $item)
{
$_product = Mage::getModel('catalog/product')->load($item->getProductId());
$att_value= $_product->getAttributeText('attributecode');
if(trim($att_value)=='lining')
{
$liningcnt +=$item->getTotalQty();
}
}
No comments:
Post a Comment