0

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 2

3

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.

6
  • 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
    @BabyinMagento2 See my edit.
    – Marius
    Commented Mar 5, 2015 at 7:42
  • ultimate you are ,as always..... Commented Mar 5, 2015 at 7:43
  • 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
  • Not working for me...Any Suggestions?
    – AkshayT
    Commented May 23, 2015 at 14:03
1

What you're looking for is an Ajax solution. There are many extensions available to implement this for you, here are a few examples:

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.

4
  • will this extension work for 1.9 vwersion? Commented Mar 5, 2015 at 6:36
  • 1
    I 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.
    – Moose
    Commented 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
  • 1
    I 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.
    – Moose
    Commented Mar 5, 2015 at 7:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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