-
-
Save Dan0sz/065ee983db0b090ba3fbf728a1cd8e43 to your computer and use it in GitHub Desktop.
Return total number of items in Cart in Magento 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$_cartQty = $this->helper('checkout/cart')->getItemsCount(); // Shows the different kind of items in cart (NOT TOTAL!) | |
$_cartQty = $this->helper('checkout/cart')->getSummaryCount(); // Shows the total amount of items in cart | |
$_cartQty = Mage::getModel('checkout/cart')->getQuote()->getItemsQty(); // Alternative method | |
$_cartQty = round(Mage::getModel('checkout/cart')->getQuote()->getItemsQty(), 0); // You can strip the decimals (everything after the dot) by wrapping it in a round-function | |
// To increase readability you could also do the following: | |
$_cartQty = Mage::getModel('checkout/cart')->getQuote()->getItemsQty(); | |
$_cartQty = round($_cartQty, 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment