Fix add to cart (redirect to homepage) bug
Posted on 12. Sep, 2008 by Fido in Development, Magento
Some people have run into a bug (apparently since version 1.1.3) where (not matter the settings in the backend) the users were getting redirected to the home page after they added a product to the cart.
Naturally this won’t be what most people want. (There is the option in the backend to set “After adding a product redirect to shopping cart” to ‘Yes’ or ‘No’ but this bug is ignoring this).
The fix for this bug that has reported some success is as follows:
In app\code\core\Mage\Checkout\Helper\Cart.php
around line 59 change:
//$continueShoppingUrl = $currentCategory->getUrl(); $continueShoppingUrl = $this->_getRequest()->getRequestUri();
To:
$continueShoppingUrl = $currentCategory->getUrl(); //$continueShoppingUrl = $this->_getRequest()->getRequestUri();
I have not tested this myself (Haven’t run into the bug) but this has been reported to work on the forums.
I want to mention that rather than editing Cart.php directly, you should copy it and it’s file structure to the Local folder so you are not hacking into Core code and can revert back at any time.
So, copy Cart.php, add it to: app/code/local/Mage/Checkout/Helper/ , make your changes to your copy of Cart.php and make sure it’s in that new directory. It will override the Core code.

One Comment
Greg Wessels
02. Oct, 2008
This just saved me a headache. Thanks a ton for this post! Keep up the good work
Leave a reply