Friday 18 November 2011

How to show cart quantity in magento


Hello Everyone,

              Today I’m going to tell you about how to show cart quantity in magento.In simple words, This tutorial will tell to add cart quantity anywhere in page according to client requirement.For example My clients requirement was to show cart quantity in shopping cart in header as shown here 
Baba N Baby

       For this, you need to Copy paste the following code to your file where you want to show the quantity.For example i wanted to show quantity in header so i need to edit header.phtml file.Similarly you can edit left column, right column etc.

Code to show cart Quantity :


<?php 
  function getCartQuantity () {
   $cart = Mage::getModel('checkout/cart')->getQuote()->getData();
   if (isset($cart['items_qty']))
   return (int)$cart['items_qty'];
   else
    return 0;
  }
  echo getCartQuantity ();  
?> 


 So in this way you can add cart quantity to some image like 



For any magento customization contact :
Company : Parsys Media
Mumbai Office :
Mobile No : +91-8123481528(Ashish Khadpe)