[Skip to main content](#vessel-content)

#   Update multiple items with one AJAX call?

##

- **[apollo123](/forum/user/1244-apollo123 "View apollo123's Profile")**
- [![apollo123's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1244-apollo123 "View apollo123's Profile") Topic Author
- [ Offline](/forum/user/1244-apollo123)

Less More

- Posts: 22
- Thank you received: 0
-
-

12 years 10 months ago [\#134988](#134988) by [apollo123](/forum/user/1244-apollo123 "View apollo123's Profile")  *[Update multiple items with one AJAX call?](/forum/25-install-update/864063-update-multiple-items-with-one-ajax-call#134988 "Hi Nicholas,  Is it possible to update multiple items with a single ajax call? This will update a single product:   www.demo.hikashop.com/index.php?option=c...kout=1&amp;product&#95;id=ZZ  My site let´s users configure a product , consisting of multiple products and when they are satisfied with the result, add it to the cart. Much like a car configurator. What the site then does, is loop through all the products they have selected and make a ajax call for each, adding all needed items to the cart.  This works, but it is a bit slow (need to make 8 ajax calls). Is there any other way doing this with 1 call?")* was created by *[apollo123](/forum/user/1244-apollo123 "View apollo123's Profile")*

Hi Nicholas,

Is it possible to update multiple items with a single ajax call?
This will update a single product:
[ www.demo.hikashop.com/index.php?option=c...kout=1&amp;product\_id=ZZ](http://www.demo.hikashop.com/index.php?option=com_hikashop&ctrl=product&task=updatecart&quantity=YY&checkout=1&product_id=ZZ)

My site let´s users configure a product , consisting of multiple products and when they are satisfied with the result, add it to the cart.
Much like a car configurator.
What the site then does, is loop through all the products they have selected and make a ajax call for each, adding all needed items to the cart.

This works, but it is a bit slow (need to make 8 ajax calls).
Is there any other way doing this with 1 call?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg2NDA2My11cGRhdGUtbXVsdGlwbGUtaXRlbXMtd2l0aC1vbmUtYWpheC1jYWxsP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86290
- Thank you received: 14268
-
-

12 years 10 months ago [\#135157](#135157) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Update multiple items with one AJAX call?](/forum/25-install-update/864063-update-multiple-items-with-one-ajax-call#135157 "Hi Nicholas,  Is it possible to update multiple items with a single ajax call? This will update a single product:   www.demo.hikashop.com/index.php?option=c...kout=1&amp;product&#95;id=ZZ  My site let´s users configure a product , consisting of multiple products and when they are satisfied with the result, add it to the cart. Much like a car configurator. What the site then does, is loop through all the products they have selected and make a ajax call for each, adding all needed items to the cart.  This works, but it is a bit slow (need to make 8 ajax calls). Is there any other way doing this with 1 call?")*

Hi,

You can do like that: Code:

http://www.demo.hikashop.com/index.php?option=com_hikashop&amp;ctrl=product&amp;task=updatecart&amp;data[ZZ]=YY&amp;data[AA]=BB&amp;checkout=1

That will add YY items of the product with the id ZZ and BB items of the product with the id AA in the cart at the same time.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg2NDA2My11cGRhdGUtbXVsdGlwbGUtaXRlbXMtd2l0aC1vbmUtYWpheC1jYWxsP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[apollo123](/forum/user/1244-apollo123 "View apollo123's Profile")**
- [![apollo123's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1244-apollo123 "View apollo123's Profile") Topic Author
- [ Offline](/forum/user/1244-apollo123)

Less More

- Posts: 22
- Thank you received: 0
-
-

12 years 10 months ago [\#135217](#135217) by [apollo123](/forum/user/1244-apollo123 "View apollo123's Profile")  Replied by *[apollo123](/forum/user/1244-apollo123 "View apollo123's Profile")* on topic *[Update multiple items with one AJAX call?](/forum/25-install-update/864063-update-multiple-items-with-one-ajax-call#135217 "Hi Nicholas,  Is it possible to update multiple items with a single ajax call? This will update a single product:   www.demo.hikashop.com/index.php?option=c...kout=1&amp;product&#95;id=ZZ  My site let´s users configure a product , consisting of multiple products and when they are satisfied with the result, add it to the cart. Much like a car configurator. What the site then does, is loop through all the products they have selected and make a ajax call for each, adding all needed items to the cart.  This works, but it is a bit slow (need to make 8 ajax calls). Is there any other way doing this with 1 call?")*

Super. Thank you ![:)](/media/kunena/emoticons/8.png ":)")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg2NDA2My11cGRhdGUtbXVsdGlwbGUtaXRlbXMtd2l0aC1vbmUtYWpheC1jYWxsP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[apollo123](/forum/user/1244-apollo123 "View apollo123's Profile")**
- [![apollo123's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1244-apollo123 "View apollo123's Profile") Topic Author
- [ Offline](/forum/user/1244-apollo123)

Less More

- Posts: 22
- Thank you received: 0
-
-

12 years 10 months ago [\#135321](#135321) by [apollo123](/forum/user/1244-apollo123 "View apollo123's Profile")  Replied by *[apollo123](/forum/user/1244-apollo123 "View apollo123's Profile")* on topic *[Update multiple items with one AJAX call?](/forum/25-install-update/864063-update-multiple-items-with-one-ajax-call#135321 "Hi Nicholas,  Is it possible to update multiple items with a single ajax call? This will update a single product:   www.demo.hikashop.com/index.php?option=c...kout=1&amp;product&#95;id=ZZ  My site let´s users configure a product , consisting of multiple products and when they are satisfied with the result, add it to the cart. Much like a car configurator. What the site then does, is loop through all the products they have selected and make a ajax call for each, adding all needed items to the cart.  This works, but it is a bit slow (need to make 8 ajax calls). Is there any other way doing this with 1 call?")*

Hi again Nicholas,
After doing some testing, I have found that this solution has a few issues.
I thought I would use this code to loop through the contents of the cart to delete all items present, before adding the new ones.
However setting the quantity to 0 does not seem to do the trick.

Another thing, if you add a product that is already in the cart, it will not add to the quantity field, but rather insert a new product in the cart. So you will have 2 identical products present in the cart.

If there is another way to simply empty the cart (ajax), please do let me know (apart from looping through and executing an ajax call for each item)

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg2NDA2My11cGRhdGUtbXVsdGlwbGUtaXRlbXMtd2l0aC1vbmUtYWpheC1jYWxsP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[apollo123](/forum/user/1244-apollo123 "View apollo123's Profile")**
- [![apollo123's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1244-apollo123 "View apollo123's Profile") Topic Author
- [ Offline](/forum/user/1244-apollo123)

Less More

- Posts: 22
- Thank you received: 0
-
-

12 years 10 months ago [\#135370](#135370) by [apollo123](/forum/user/1244-apollo123 "View apollo123's Profile")  Replied by *[apollo123](/forum/user/1244-apollo123 "View apollo123's Profile")* on topic *[Update multiple items with one AJAX call?](/forum/25-install-update/864063-update-multiple-items-with-one-ajax-call#135370 "Hi Nicholas,  Is it possible to update multiple items with a single ajax call? This will update a single product:   www.demo.hikashop.com/index.php?option=c...kout=1&amp;product&#95;id=ZZ  My site let´s users configure a product , consisting of multiple products and when they are satisfied with the result, add it to the cart. Much like a car configurator. What the site then does, is loop through all the products they have selected and make a ajax call for each, adding all needed items to the cart.  This works, but it is a bit slow (need to make 8 ajax calls). Is there any other way doing this with 1 call?")*

I am guessing you have to get the 'cart Item ids' instead of the product ids for deleting them like this?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg2NDA2My11cGRhdGUtbXVsdGlwbGUtaXRlbXMtd2l0aC1vbmUtYWpheC1jYWxsP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[apollo123](/forum/user/1244-apollo123 "View apollo123's Profile")**
- [![apollo123's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1244-apollo123 "View apollo123's Profile") Topic Author
- [ Offline](/forum/user/1244-apollo123)

Less More

- Posts: 22
- Thank you received: 0
-
-

12 years 10 months ago [\#135373](#135373) by [apollo123](/forum/user/1244-apollo123 "View apollo123's Profile")  Replied by *[apollo123](/forum/user/1244-apollo123 "View apollo123's Profile")* on topic *[Update multiple items with one AJAX call?](/forum/25-install-update/864063-update-multiple-items-with-one-ajax-call#135373 "Hi Nicholas,  Is it possible to update multiple items with a single ajax call? This will update a single product:   www.demo.hikashop.com/index.php?option=c...kout=1&amp;product&#95;id=ZZ  My site let´s users configure a product , consisting of multiple products and when they are satisfied with the result, add it to the cart. Much like a car configurator. What the site then does, is loop through all the products they have selected and make a ajax call for each, adding all needed items to the cart.  This works, but it is a bit slow (need to make 8 ajax calls). Is there any other way doing this with 1 call?")*

SOLVED. (Using cart id´s will make this work)

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg2NDA2My11cGRhdGUtbXVsdGlwbGUtaXRlbXMtd2l0aC1vbmUtYWpheC1jYWxsP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop- Install &amp; Update- Product &amp; Category Display- Content Creation- Sales and Orders- - Orders management- - Reports &amp; Statistics- Customers- Checkout- Payment Methods- Shipping Methods- Import &amp; Export (CSV, XLS…)- Specific Features- - Affilation- - Taxes- - Wishlist- - Vote- - Carousel &amp; Slider- - Mass Actions- - Filters &amp; Search- - Discount &amp; Coupon- - Feature Request- Integrations- Showcase- General Talk about HikaShop- Development- - HikaShop 3.0 Beta- Translation- Commercial Jobs HikaShop Components- HikaMarket- - Market: Feature requests- - Market: How to?- - Market: Bug Report- HikaSerial- - General talk about HikaSerial- - Serial: Bug Report- - Serial: How to?- - Support en Français de HikaSerial (French Support)- - HikaSubscription- HikaAuction- - Auction: Feature requests- - Auction: How to?- - Auction: Bug report Hikashop around the world- Support en Français (French Support)- Russian- - FAQ. Курс выживания с Hikashop. Частые вопросы и о- - Расширения Hikashop- - Наши сайты на Hikashop- 日本語版サポート(Japanese Support)- Thai- German Archives- Bug Report- How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.245 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)

[](#top)
