Magento - How to get cart items total in header.phtml

前端 未结 7 1327
孤街浪徒
孤街浪徒 2021-02-05 12:11

I am using Magento eCommerce and I have modified my header.phtml via the Blank template. Code, this is my code but it shows blank.

 

        
7条回答
  •  花落未央
    2021-02-05 12:42

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

    this works for me thanx...

提交回复
热议问题