Stop an out-of-stock product returning to the product page when you add it to your cart
Question
At the moment, if I add an item to my product which is out-of-stock, it goes to the product page with an "out of stock" message.
However, what I want is for it to still go to the cart page, but have an "out of stock" message there instead.
I am generating my link to add the product to the cart as follows: Mage::helper('checkout/cart')->getAddUrl($_newProduct);
Solution
You can override Mage_Checkout_CartController
and change the redirect behaviour of the public function addAction()
to achieve what you are looking for.
I think you should check around line 260 of that class to see how the redirect is being performed.
$this->_goBack();
is the function you are looking for.
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange