RSS

Magento-Display Shopping Cart in Header

24 Nov

Go to app\design\frontend\base\default\template\page\html\header.phtml
Add the following code inside the header-container div to display total number of  items and price in header .

<?php
  $count = $this->helper('checkout/cart')->getSummaryCount();  //get total items in cart
  $total = $this->helper('checkout/cart')->getQuote()->getGrandTotal(); //get total price
  if($count==0)
  {
    echo $this->__('Items: %s',$count);
  }
  if($count==1)
  {
    echo $this->__(' Item: %s',$count);
  }
  if($count>1)
  {
    echo $this->__(' Items: %s',$count);
  }
  echo $this->__(' Total: %s', $this->helper('core')->formatPrice($total, false));
?>

——————
For Magento 1.4

 
6 Comments

Posted by on November 24, 2010 in Magento

 

Tags: , , , , , , , , , , ,

6 responses to “Magento-Display Shopping Cart in Header

  1. Nan

    August 2, 2011 at 5:46 AM

    This is exactly what I was looking for…have been trying to get it to work perfectly for days. This really worked like a charm – thanks heaps!

     
  2. Gnanadoss

    January 10, 2012 at 12:24 PM

    Thanks a lot….

     
  3. khaleel

    January 19, 2012 at 5:20 PM

    Yes thanks, subscribed to.. look forward to Magento stuff. This works in Magento 1.6 too.

     
  4. scott

    April 13, 2012 at 3:27 AM

    Thanks a bunch!!

     
  5. kikobot

    June 4, 2012 at 8:14 AM

    Instant success…

     
  6. Suramya

    June 14, 2012 at 8:58 AM

    Thanks a lot ..Good one🙂

     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: