How: Add Ajax delete from cart button

Phoca Cart - complex e-commerce extension
maintainthedomain
Phoca Member
Phoca Member
Posts: 46
Joined: 21 Sep 2018, 11:34

How: Add Ajax delete from cart button

Post by maintainthedomain »

Hi great phoca people!

I could manage to add a delete button to the cart module. I just copied the form and button from cart_checkout.php to cart_cart.php and set the task to checkout.update.

Now, of course every time an article is deleted the page refreshes, as this is I guess necessary for checkout view.

How can we make this an Ajax delete button??

Thanks in advance!
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48402
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: How: Add Ajax delete from cart button

Post by Jan »

Hi, there is no problem to make the delete button as AJAX, the problem is when you delete some item from the cart, then everything changes:

- product discount, cart discount, coupons must be recalculated - because there are rules based on count of items or sum of items
- shipping method needs to be reset - because rules are based on sum or another rules
- payment method needs to be reset - the same like shipping method.

So when removing item from the cart, not only the whole checkout page must be refreshed but even the module cart. So this is why whole site is refreshed, because with deleteing everything changes.

Jan
If you find Phoca extensions useful, please support the project
Post Reply