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)

4 comments:

  1. Working for me, also trying to do some transition effects

    ReplyDelete
  2. Much obliged for sharing helpful post with respect to site advancement. Before begin site advancement work you ought to enhanced site in legitimate way like you house well ordered systems in your post.
    E-commerce development services
    Magento ecommerce development agency

    ReplyDelete