Showing posts with label total. Show all posts
Showing posts with label total. Show all posts

Wednesday, January 13, 2010

how to display number of items in cart and cart total (for elmuchoprez)

Problem: how to display number of items in cart and cart total?
Possible solution

To display items in cart do this:
$this->helper('checkout/cart')->getSummaryCount();
or
Mage::helper('checkout/cart')->getSummaryCount();
And for the total:
Mage::getSingleton('checkout/session')->getQuote()->getSubtotal();
This will display only the total amount for the products.
If you want the grand total (including shipping & handling) do this:
Mage::getSingleton('checkout/session')->getQuote()->getGrandTotal();