Welcome Guest, Not a member yet? Register   Sign In
Cart class insertion question.
#1

[eluser]mrbinky3000[/eluser]
I have a question about how the cart class works.

If I have a button on my website that uses ajax to add an item to the cart.

What happens if I press that button multiple times and call the same routine, with the same arguments, to add the same product to the cart multiple times? Does each successive call to insert() increase the quantity by one? That is my desired outcome. Or, does it insert multiple rows of the same order to the cart?
#2

[eluser]mrbinky3000[/eluser]
Answered my own question. If you press the button over and over again, insert() replaces the existing row with the new one. So, the quantity remains at 1 item.

In order to get my desired outcome (increasing the quantity by one) I'm going to have to do some sort of detection. Working on that now. Will post results.
#3

[eluser]PeterGreffen[/eluser]
You might want to check out this post.
aggrav8d came up with this excellent cart patch!




Theme © iAndrew 2016 - Forum software by © MyBB