更新时间:2023-10-25 14:09:46
获取您的购物车对象(在会话中):
To get your cart object (in session) :
$quote = Mage::getSingleton('checkout/session')->getQuote();
然后,获取购物车中的商品列表:
Then, to get the list of items in the cart :
$cartItems = $quote->getAllVisibleItems();
然后,获取每个项目的计数:
Then, to get the count for each item :
foreach ($cartItems as $item) {
echo $item->getQty();
}