When I add something from the category
to the basket/cart
it redirects me to the basket/cart
.
After searching I found that I could turn this functionality of in the admin system via
Configuration > Sales | Checkout > After Adding a Product Redirect to Shopping Cart
It now redirects to the Home page. I don't know if this a bug in the redirect?
Best Answer
If you look into the cart controller
app/code/core/Mage/Checkout/controllers/CartController.php
your will find the function_goBack
. This is where the return url is decided by Magento.The section your are looking for is the call to
_getRefererUrl
this happens when you are not setting the return url as a parameter and not using the default redirect to cart option.Inside the function
_getRefererUrl
the referrer url is checked to see if it is an internal url, when it is not internal than the base url is used.I would suggest that either your referrer url is external or there is something wrong with the check.
Have a look at
Mage_Core_Controller_Varien_Action::_isUrlInternal
to debug if the url is internal or not.Problem was that _isUrlInternal was failing because of having the port in the base url