Magento add to cart issue on caching new products

Viewed 8058

I’m having problem with add to cart function in new products widget in the homepage. By clicking on “Add to cart” it load /checkout/cart/ page but I receive “The cart is empty!”. I checked for JS problems but I haven’t any error, also in system log. In cache management, if I disable only BLOCK_HTML cache it works fine; if I re-enable it I have the problem

The website is hosted by siteground, actually in cron I have: every 25 min.: php /home/ledsuper/public_html/cron.php > /dev/null every 30 min.: /bin/sh /home/ledsuper/public_html/cron.sh

What is causing the problem? how can I do to try solve? Thx

5 Answers
 if (!($formKey = $this->getRequest()->getParam('form_key', null)) || $formKey != Mage::getSingleton('core/session')->getFormKey()) {
                $this->getRequest()->setParams(array('form_key' =>Mage::getSingleton('core/session')->getFormKey()));
     }   

You can make the above code as a module It is worked for me. But i did not make it as an module. I directly updated the following file

app/code/core/Mage/Checkout/controllers/CartController.php

There is a function

addAction Paste the above code in beginning thats all.

Related