When clicking on the add to wishlist
button, I want to remain on the same page & perform the add function without redirecting to the wishlist page - is this possible?
2 Answers
You need to rewrite the method _addItemToWishList
from the controller Mage_Wishlist_IndexController
and replace the last line.
Instead of
$this->_redirect('*', array('wishlist_id' => $wishlist->getId()));
You have to put:
$this->_redirectReferer();
[EDIT].
Here is an example on how you can rewrite a controller.
You need to rewrite (like I said) Mage_Wishlist_IndexController
. The controller is found in app/code/core/Mage/Wishlist/controllers/IndexController.php
.
-
hi boss, thanks a lot for helping me again , again & again.... please tell me which in which folder and file..?... Commented Mar 5, 2015 at 7:40
-
1
-
-
i will copy app/code/core/Mage/Wishlist/controllers/IndexController.php. and do changes here : app/code/Local/Mage/Wishlist/controllers/IndexController.php. Commented Mar 5, 2015 at 7:46
-
What you're looking for is an Ajax solution. There are many extensions available to implement this for you, here are a few examples:
- VS Ajax- Add To Cart, Add To Wishlist, Add to Compare, Paging, Toolbar,
- AJAX - Add to Cart, Add to Wishlist
Alternately, if you'd like to implement it yourself, here is a guide:
Excellence Magento Blog - Ajax Based Add Product to Wishlist and Compare Products
This includes an extensive walkthrough on implementing this feature - as well as the module attached.
-
-
1I don't see why not, although neither extension explicitly states that they support 1.9 . Try it on your staging environment and let us know.– MooseCommented Mar 5, 2015 at 7:00
-
thanks i will try , did you used any of above extension? any side effects did you faced? Commented Mar 5, 2015 at 7:16
-
1I have not, no. That's why it's best to always test any extension on a staging environment. Both of the extensions listed though are well reviewed & have a decent user base. Read through the reviews.– MooseCommented Mar 5, 2015 at 7:25