How to get Total Cart Item and total Price in magento

<?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 more magento tutorial visit: <a title="http://blog.free-extension.com" href="http://blog.free-extension.com">http://blog.free-extension.com/</a>
?>

for more magento tutorial visit: http://blog.free-extension.com/

Advertisements
  1. Thanks for this code, works perfectly! I needed it for a custom made overview.

  2. I constantly spent my half an hour to read this weblog’s posts everyday along with a cup of coffee.

  3. Hey There. I found your weblog using msn. That is a really well written article.
    I’ll be sure to bookmark it and return to learn extra of your useful information. Thank you for the post. I’ll definitely comeback.

  1. No trackbacks yet.

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: