Answers:
Mage::helper('checkout/cart')->getItemsCount() -- return shopping cart items count means how many sku add to shopping cart.
Mage::helper('checkout/cart')->getSummaryCount() -- return shopping cart items summary (suppose you add sku1 6 qty and sku2 3 qty = total 9 qty return)
这样getItemsCount将起作用:
Mage::helper('checkout/cart')->getCart()->getItemsCount();
如果没有,请尝试将其添加到getItemsCount行上方:
Mage::getSingleton('core/session', array('name'=>'frontend'));
对于摘要计数:
$count = $this->helper('checkout/cart')->getSummaryCount(); //get total items in cart