Wishlist Not Clearing When items moved to cart

  • Posts: 22
  • Thank you received: 0
  • Hikashop Business
3 years 5 months ago #235056

-- HikaShop version -- : 2.6.1
-- Joomla version -- : 3.4.8
-- PHP version -- : 5.4.45

I am not sure if this is standard behavior of not. When a user add items to his Wishlist then places a check next to each item and clicks "Add To Cart", the items do not clear out from his wishlist. They do transfer over to the cart but a copy of them remains in the wishlist. Is this standard? If so, can anything be changed to remove the items once added to the cart?

Please Log in or Create an account to join the conversation.

  • Posts: 66889
  • Thank you received: 9887
  • MODERATOR
3 years 5 months ago #235117

Hi,

Yes, that's the normal behavior. There is no option to change that.
But it's always possible to modify the code to do what you want if you're a developer.
You would have to edit the function addtocart of the file components/com_hikashop/controllers/cart.php
The code would have to set/reset the cart_type and cart_id in both the session and the request and call the update function from the class.cart with a quantity of 0 on the product_id in order to do that.

Please Log in or Create an account to join the conversation.

  • Posts: 22
  • Thank you received: 0
  • Hikashop Business
3 years 5 months ago #235118

Thank you so much for that detailed help, I can't begin to thank you enough for that. I will look into the modification, I actually peered around it a bit after asking the question to see what was possible. In the long run, however, I think since the modification would be to a controller I will leave it in its normal state to preserve it ability to receive regular updates. We will probably just add a text string at the top of the page to alert the user of the expected behavior.
Have a nice day!

Please Log in or Create an account to join the conversation.

  • Posts: 2
  • Thank you received: 0
2 months 1 week ago #308430

Hi Nicolas,
If we add custom field in product then cart is not clearing.i have added following On line 420 in
/components/com_hikashop/controllers/cart.php
$cartClass->update($product_in_cart->cart_product_id, 0,0,'item',true,false,$cart_id);
then cart is cleared in wishlist .

Please Log in or Create an account to join the conversation.

  • Posts: 66889
  • Thank you received: 9887
  • MODERATOR
2 months 1 week ago #308434

Hi,

Thank you for your feedback. However, I'm not able to reproduce your problem.
On a cart/wishlist, depending on the situation, you'll get two buttons: "add to" and "move to". The "add to" will copy the product to the target cart/wishlist while the "move to" will do the copy AND remove the product from where you had it.
The piece of code you're pointing out is in the if($add) which means that it's done when the "add to" button is used, not the "move to".
So it's normal that in that case the original is not removed.
Now you might have an issue if you're using the "move to" button and it's doing an "add to". In that case, it's probably a view override issue.
Anyways, to be able to better understand the situation, it would help if you could provide a link to the page with instructions to reproduce so that we can look into it. And check what problem you really have in order to properly fix it, if there is a problem.
We unfortunately can't accept your patch unless we properly understand the situation.

Please Log in or Create an account to join the conversation.

  • Posts: 2
  • Thank you received: 0
2 months 1 week ago #308453

Hi Nicholas,
Thank you for revert back to me.Let me try to explain .when i create custom field for item the original product is is not created and it will treat product as new product id.
if i created item with name orderid and pass it to through the system this new product id is saved in cart_product and later go to order_product table.
Now i go to hikashop cart and click on move_to and move the product to wishlist's.
if i go to wishlist and then select product and click on add to cart it will add the product in cart but never remove the product from wish list.that mean customer have to remove manually.
so i added this code.

Please Log in or Create an account to join the conversation.

  • Posts: 66889
  • Thank you received: 9887
  • MODERATOR
2 months 1 week ago #308455

Hi,

Thank you for the details.
It's actually normal that if you click on the add to cart button, it adds the product to the cart and doesn't remove the product from the wishlist.
If you want to do that, then you need to click on the "move to" button instead.
If you do your change, then both the "move to" and the "add to" button will do the same thing.
If the modification you made works for you, then great, but I'm afraid we won't be able to include it on our end if we're talking about the same thing.

Please Log in or Create an account to join the conversation.

Time to create page: 0.075 seconds
Powered by Kunena Forum