0

How to disable or redirect to same page after pushing add to wishlist button? Same way you can disable it for add to cart.

6

You can override the add to wishlist action in the wishlist controller and make it redirect to the referrer.

Override this method Mage_Wishlist_IndexController::addAction() and replace this:

$this->_redirect('*', array('wishlist_id' => $wishlist->getId())); 

with this:

$this->_redirectReferer()
| improve this answer | |
  • Its not working for me Any Suggestion? – Akshay Taru May 23 '15 at 14:01
  • @AkshayTaru Check for any other module which may be overriding core Wishlist module. – Mukesh Jun 24 '15 at 9:52
  • Using Magento 1.9.2.4 the method to override is Mage_Wishlist_IndexController::_addItemToWishList(), the row remains the same. – WaPoNe Jun 28 '16 at 9:03
  • With this Solution, success message is not showing on same page...how to display wishlist success message also on same page? – Faisal Sheikh Jul 16 at 14:44
1

Actually the "addAction" in turn calls "_addItemToWishList" function, so you have to override that function in wishlist IndexController.php

Refer the below link, it shows how to override wishlist controller, also take care of the issue it has posted:

https://stackoverflow.com/questions/25740342/overriding-mage-wishlist-indexcontrolleraddaction-in-magento/31020402#31020402

As it says replace the $this->_redirect('*', array('wishlist_id' => $wishlist->getId())); with $this->_redirectReferer();

Also don't let any spaces between "<" and tag name in any of the magento's xml files, it breaks xml structure.

For cart you have to override cart controller with minor function name change.

Hope this helps, let me know in comments.

| improve this answer | |
0

Override this method Mage_Wishlist_IndexController::addAction() and replace below code:

$this->_redirect('*', array('wishlist_id' => $wishlist->getId())); 

with following:

$this->_redirectUrl(Mage::helper('core')->escapeUrl($referer));
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.