top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

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

+3 votes
523 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 LinkedIn 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....
...