Ajax Removal of Cart Items

Hi There,

Ok this might be a bit complicated to explain but let me try it:



Removal of items through ajax requires few more things:

[list]

[]Adding ajax class to links of removal (anchor holding image)

[
]Updating shopping cart using hook, I was able to do it in checkout.php, removed if condition for from_status, I wish I could do it by an other possible way.

[]Since there was no form, so probably we can't have call back function, So I did that using setTimeout on click event, Yup this is bad, but I am able to remove entire node after click

[
]Main thing is left, how can I update amount just besides cart?

[/list]



I can do it with ajax of jquery, but trust me it isn't way to go. I just want to make sure I agree with cscart framework rather than doing bad practices. My client seems to be concern for it as well.



I don't see any point when people add 5 items for sake of filtering at cart and then get annoyed. Loading page again and again is also a performance issue.

He is one 2.2.2 I believe I am not really CS Cart guy. I belongs to vamcart - cakePHP cart

Not clear on what you are really trying to accomplish.

You don't want the users to simply click the X next to the product to remove it or adjust the quantity and then click Update?



The “cart” is actaully held in the $_SESSION area. You can update it via an ajax request, but then it won't be reflected in all the little areas that need to be updated (total weight of order, total price, etc.). You can remove the items and set the $_SESSION['cart']['cart_recalculate'] = true which will force it to recalculate upon next load.



Providing a usage scenario of what you want to accomplish rather than a description of what you did might help get more ideas on how to accomplish your goals.

Aim: To remove items in cart through ajax and update total at index.php?dispatch=checkout.cart

Problem: I am able to remove cart items through ajax but I am yet to update total.

Question: How can I update total as soon as I remove items through cart via ajax.

I am hopping now that I am clear.


[quote name='tbirnseth' timestamp='1322525172' post='126891']

Not clear on what you are really trying to accomplish.

You don't want the users to simply click the X next to the product to remove it or adjust the quantity and then click Update?



The “cart” is actaully held in the $_SESSION area. You can update it via an ajax request, but then it won't be reflected in all the little areas that need to be updated (total weight of order, total price, etc.). You can remove the items and set the $_SESSION['cart']['cart_recalculate'] = true which will force it to recalculate upon next load.



Providing a usage scenario of what you want to accomplish rather than a description of what you did might help get more ideas on how to accomplish your goals.

[/quote]

Set the $_SESSION['cart']['recalculate'] to true when you remove the items.

[quote name=‘tbirnseth’ timestamp=‘1322608822’ post=‘126968’]

Set the $_SESSION[‘cart’][‘recalculate’] to true when you remove the items.

[/quote]

Solved, thanks for your post, I managed to run one more ajax :rolleyes: