Jump to content

Weird problem with multiple addToCart calls


Recommended Posts

Hi all,

 

I've made the following:

 

On each product page I display a table with the attributes of the product in which you get to see the price and you get a  'requested amount' input box. Customers can order multiple items 'at once', so if they want 10 items of the first attribute and 20 of the third, they just fill out the form, hit 'add to cart' and both items get added to the cart.

 

post-748699-0-75602300-1391954731_thumb.png

 

Works pretty fine, but I had to take out the animation (no big deal) and I've played around with timed loops etc, but that's not the issue. So now it seems solid, BUT (and here's where I hope someone has some kind of input) every first time I visit the page and trigger the function, only the last item gets added while I was asking to add 4 or 10, so all others get removed after being added. After that, the function just works fine and adds the entire list to the cart.

 

My thoughts are that somewhere in the initial call there's one action (set cookie maybe?) which is causing this strange behavior (ie. causing lag or has to be executed before all other stuff can take place). I'm not sure where to look and which tools to use to debug it because I'm extremely new to PS and I'm actually a shop owner, not a coder (I used to be ;) ). Any input is highly appreciated.

Edited by FonZ (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...
×
×
  • Create New...