开发者

Get the number of cart items in logout page

How can I get the number of cart items in logout page, I try to use the following code, it开发者_高级运维 works in cart.phtml but not in logout.phtml

$cart = Mage::getSingleton('checkout/cart')->getItemsCount();
echo 'cart items count: ' . $cart;
$cart = Mage::helper('checkout/cart')->getItemsCount();
echo 'cart items count: ' . $cart;
$cart = Mage::helper('checkout/cart')->getCart()->getItemsCount();
echo 'cart items count: ' . $cart;

I suppose since it is already logged out it doesn't get access any more, should I try to get that information using cookies?

Thanks in advance for any help


i use this :

Mage::helper('checkout/cart')->getCart()->getQuote()->getItemsCount()


Well I use

$cart = Mage::helper('checkout/cart')->getCart()->getItemsCount();

in my mini.login.phtml which I put in the footer of my pages and the good news is it does get the item count in the cart. The bad news is, it does not update immediately after I add a product, so I need to refresh the cache.


$cart = Mage::helper('checkout/cart')->getItemsCount();

This is stated and points to your getItemsCount();

Why does this need two lines to just say the third line of code? Not trying to be mean just asking.

What im saying is: Why not use this.

$cart = Mage::helper('checkout/cart')->getCart()->getItemsCount();
echo 'cart items count: ' . $cart;

Once instead of stating the same thing twice with less information.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜