Magento get number of items in cart by category -
i attempting number of items in users cart, each category. must appreciated.
take @ magento: limit 3 products category per order
..... $quote = mage::getsingleton('checkout/session')->getquote(); foreach($quote->getallvisibleitems() $item){ $product = mage::getmodel('catalog/product')->load($item->getid()); $product_category_ids = explode(",", $product->getcategoryids()); //$product_category_ids = $product->getcategoryids(); foreach($product_category_ids $category_id){ $category_ids[$category_id]['category_id'] = $category_id; $category_ids[$category_id]['product_count'] = ($category_ids[$category_id]['product_count']) ? $category_ids[$category_id]['product_count'] + $item->getqty() : $item->getqty(); } }
Comments
Post a Comment