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

前端 未结 7 1324
孤街浪徒
孤街浪徒 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:40

    Use the helper object to get the current cart object, and then count the number of items in the cart object.

    echo Mage::helper('checkout/cart')->getCart()->getItemsCount();
    

    More from http://www.douglasradburn.co.uk/how-to-get-number-of-cart-items-in-magento/

提交回复
热议问题