29 pointsStarting to get into this DEV thingI'm new here
mysolarix
Member
—
7th February 2012 (3 months ago)
Hi,
Consider the following:
Products:
Item 1
Item 2
Item 3
If I click the "add_to_cart" button of each item separately, which is only click on the other Item add_to_cart button after the previous one has executed. It works perfectly fine.
But if I continuously click the add_to_cart button one after another without waiting one to complete, only the last item click will be added to the cart.
Consider the following:
Products:
Item 1
Item 2
Item 3
If I click the "add_to_cart" button of each item separately, which is only click on the other Item add_to_cart button after the previous one has executed. It works perfectly fine.
But if I continuously click the add_to_cart button one after another without waiting one to complete, only the last item click will be added to the cart.
Since the button used ajax, so the user should not have to wait to execute another add_to_cart (at least this is what i think). Is it possible to made all the button clicks count, and not just the last button click to add to cart.
It may be due to everytime when the add_to_cart button clicked, the update_cart() function will call the get_cart_cookie() first, and the cookie is yet to be updated, that's why only the last action will update the cookie.
Responses (6)
Support Chimp — 7th February 2012 (3 months ago) #
Hey there.
I think the issue is because as you state:
Perhaps not enough time has passed for the code to fully execute?
I'll ask the plugin developer on this one as well. :-)
Take care.
Member — 7th February 2012 (3 months ago) #
Hi Timothy,
Since the button used ajax, so the user should not have to wait to execute another add_to_cart (at least this is what i think). Is it possible to made all the button clicks count, and not just the last button click to add to cart.
Thanks
Member — 7th February 2012 (3 months ago) #
May have found the cause...
It may be due to everytime when the add_to_cart button clicked, the update_cart() function will call the get_cart_cookie() first, and the cookie is yet to be updated, that's why only the last action will update the cookie.
hmm...
Lead Developer — 7th February 2012 (3 months ago) #
Yes, it's a limitation of cookies. The same cookie gets sent with each request that happens before the first request returns.
There isn't really a way to change this behavior, other than speeding up your server response, or maybe preventing clicks.
Member — 8th February 2012 (3 months ago) #
Hi aaron,
Thanks for taking time replying :)
Just a thinker, maybe deferred in jquery can be used for the case?
Lead Developer — 8th February 2012 (3 months ago) #
Ya, it may be possible to queue actions. I'll have to look at it for a future release.
Become a member