When it comes to Magento Shopping Carts, people tend to get confused between total items and total quantities. A shopping cart item is a unique product within the shopping cart and the quantity is the total number of each unique item that customers want to order. In other words, if you have two different products (ex. shirt and pants) in your shopping cart, but want to order five of each of these products, the two products are the items and the five of each product is the quantity.
For these reasons, the methods that are typically used by people to return the cart quantity is incorrect. If you find yourself using the getItemsCount() method to return the total quantity of items in your shopping cart, you’re doing it wrong. Instead, what you should be using is the getItemsQty() method, which returns the total quantity of all the items combined within your shopping cart.
How to get the Total Quantity Of All the Items In your Shopping Cart
Open the cart model and invoke the getItemsQty() method on it to return the total quantity of all the items combined within your shopping cart.
$totalQuantity = Mage::getModel('checkout/cart')->getQuote()->getItemsQty();
How to get the Total Number of Items In Your Shopping Cart
To return the total number of unique items within your shopping cart, you do the same as above but instead of using the getItemsQty() method, you need to use the getItemsCount() method.
$totalItems = Mage::getModel('checkout/cart')->getQuote()->getItemsCount();