2

I am trying to figure out how to get the customer wish list to KEEP the items in the wish list after the customer puts them in their cart / orders so they can order them again later as well.

Anyone know the file I would edit to do this (ie. comment out the part where it takes the product out of the wish list if it is put in the shopping cart)? or would something like Amasty Favorite Products extension be best?

Thanks.

2 Answers 2

3

In app/code/core/Mage/Wishlist/controllers/IndexController.php -> public function cartAction() replace this:

if ($item->addToCart($cart, true)) {

with this:

if ($item->addToCart($cart, false)) {

or directly remove the second parameter (true), because this calls app/code/core/Mage/Wishlist/Model/Item.php -> public function addToCart(Mage_Checkout_Model_Cart $cart, $delete = false) (@param bool $delete delete the item after successful add to cart).


The above is working only when "Add to cart" button is used. For button "Add all to cart" you should replace in app/code/core/Mage/Wishlist/Controller/Abstract.php -> public function allcartAction() this code:

if ($item->addToCart($cart, $isOwner)) {

with this:

if ($item->addToCart($cart, false)) {

Or you can just comment/remove $this->delete(); from app/code/core/Mage/Wishlist/Model/Item.php -> public function addToCart.

8
  • Hmm, I tried that and found another resource that suggested that as well but it didn't seem to change anything. Possible related to my theme (MobileShoppe)? Site is premierlightbulbs.com. Also having issues with the Add to Cart button within the Wishlist not working. Thanks for your suggestion though I appreciate it. Commented Jan 7, 2015 at 16:34
  • I tested it before writing the answer and it's working on clean Magento 1.9.0.1 installation. Please check if you have some extension that overwrites it or you can try to delete whole cartAction() function to test if it will return you an error (to be sure that this code is used).
    – michael
    Commented Jan 7, 2015 at 16:48
  • Definitely not an extension - just starting the site so there are no extensions there. I commented out the whole cartAction() function from line 464-550 on IndexController.php and now Wishlist just opens up a blank page, so it must be working. To be sure this is what I'm supposed to change to false where it says true, correct? $item->mergeBuyRequest($buyRequest); if ($item->addToCart($cart, true)) { $cart->save()->getQuote()->collectTotals(); } Commented Jan 7, 2015 at 17:04
  • Yes, this the code. You can also try to remove addToCart() function in app/code/core/Mage/Wishlist/Model/Item.php like you did with cartAction().
    – michael
    Commented Jan 7, 2015 at 17:52
  • Thanks Michael. I tried that too and it prevented me from adding from wishlist to cart. The button Add to Cart never worked like I mentioned but the "Add All Wishlist Products to Cart" stopped working once I commented out the addToCart () function you listed above. So that tells us the code is being used but something is not working correctly. Form key? Commented Jan 7, 2015 at 19:15
0

for the version of Magento 2: 2.1.5

the location of the file is different: vendor/magento/module-wishlist/Controller/Index/Cart.php

1
  • @Richardo hope it would be same for 2.3 but can we create customer module instead of changing it in core. secondly can we have similar option like my wish list & my design list . Where i can add my product instead in my wish list page to my design page removing this option of getting removed from cart Commented Aug 12, 2019 at 5:58

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.