Search code examples
phpmagentologoutcart

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


Solution

  • i use this :

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