Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

how to put cart item count in the footer? 1.5.1
 
richardlapes
Member
 
Avatar
Total Posts:  43
Joined:  2011-07-04
 

I’ve been searching for hours and still find no solution.

please somebody enlighten me

I’ve use Mage::getSingleton(’checkout/cart’)->getSummaryQty(); but it doesn’t update correctly when I add/remove an item in the cart unless I refresh the cache :/

 
Magento Community Magento Community
Magento Community
Magento Community
 
tzyganu
Mentor
 
Avatar
Total Posts:  2205
Joined:  2009-11-18
Bucharest, Romania
 

Hello.
This is because the footer is cached and the cache key does not include the number of items in the cart.
But I don’t recommend including the cart count in the key.

You have to options here
1. Disable cache for the footer: Override the Mage_Page_Block_Html_Footer and replace the _construct method with this:

protected function _construct()
    
{
        $this
->addData(array(
            
'cache_lifetime'=> null
        
));
    
}

2. Include the cart count in the footer cache key: (The one that I’m not recommending. But if you still want to do it.... )
Override the same class (Mage_Page_Block_Html_Footer) and make the method getCacheKeyInfo look like this:

$key parent::getCacheKeyInfo();
$key[] Mage::getSingleton(’checkout/cart’)->getSummaryQty();
return 
$key;

I hope it helps
Cheers,
Marius.

 
Magento Community Magento Community
Magento Community
Magento Community
 
richardlapes
Member
 
Avatar
Total Posts:  43
Joined:  2011-07-04
 

I tried both but still doesn\’t work for me :(

And also I forgot to put in my 1st post that the item count is the same even If I use other browser....

Now another problem occurs, I can’t login in admin page in chrome…
And I can’t add to cart because magento detects the cookie is disabled also in chrome..

downer

edit I can now add product and login in chrome and ie

 
Magento Community Magento Community
Magento Community
Magento Community
 
richardlapes
Member
 
Avatar
Total Posts:  43
Joined:  2011-07-04
 

Wow..it suddenly work after I run compilation.

I use the 1st option.

Thank you so much ^_^ V
You save me from killing myself lol..

 
Magento Community Magento Community
Magento Community
Magento Community
 
tzyganu
Mentor
 
Avatar
Total Posts:  2205
Joined:  2009-11-18
Bucharest, Romania
 

I told you it should work smile.
I don’t use the compilation of Magneto files and that’s why it slipped my mind.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top