top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

How to get total items and total price in shopping cart of magento?

+3 votes
87 views
How to get total items and total price in shopping cart of magento?
posted Aug 3, 2015 by Vrije Mani Upadhyay

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

+1 vote
 
Best answer

Please get below code for same:

<?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->__('<a href="/checkout/cart" >(0 ITEMS)</a>',$count);
  }
  if($count==1)
  {
    echo $this->__('<a href="/checkout/cart" >(1 ITEM)</a>',$count);
  }
  if($count>1)
  {
    echo $this->__('<a href="/checkout/cart" >(%s ITMES)</a>',$count);
  }
  echo $this->__('Total: %s', $this->helper('core')->formatPrice($total, false));
?>
answer Aug 8, 2015 by Amit Kumar Pandey
where we put this code....
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...