The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Bulk insert to the cart

dariodario Member
in Help edited December 2014
Hello
In our shop we are adding 10-15 items in the cart (using JSONP FC.client.request) in bulk without waiting for the previous to complete;
we noticed however that some of those are not added and the cart display less items than we sent.
All the call returns status 200 and I can see no errors in the response body. Besides all the products are the same (except for name and code) so it should not be something related to parameters.
For instance I just sent 20 requests to FC and only 17 items have been added to my cart. Do we need to wait for a call to end before sending the next one? Is there some event to listen (besides done() jsonp callback)?
What happens if a FC.client.request fails? Is done() invoked in any case or is there a different callback to handle failures?

Thanks
Tagged:
Comments
  • fc_adamfc_adam FoxyCart Team
    @dario,

    If you know all of the products at the time you're doing this bulk add - why not just add them all in a single add to cart? If you prepend each different product with a unique number in the add to cart, that will add them at the same time - like this:
    1:name=First&1:price=20&2:name=Second&2:price=10&2:color=red
    

    More information on that here: http://wiki.foxycart.com/static/redirect/add_to_cart
Sign In or Register to comment.