Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Rody 80 posts 280 karma points
    Oct 16, 2013 @ 10:50
    Rody
    0

    AddOrUpdateOrderLine javascript api with multiple bundled products

    We're using the bundled products functionality and the javascript api to update the cart. However we have a bundled product containing, let's say, 6 number of subproducts. This means a javascript call to add this complete product to the cart will take 7 javascript calls to AddOrUpdateOrderLine (main product + 6 subproducts). 

    I was wondering if it would be possible to send the data to the AddOrUpdateOrderLine method in a form of an array, so instead of doing: 

    TC.addOrUpdateOrderLine({storeId:1, productIdentifier:1261, quantity:1, bundleIdentifier:'Computer'});
    TC.addOrUpdateOrderLine({storeId:1, productIdentifier:1262, quantity:1, parentBundleIdentifier:'Computer'});
    TC.addOrUpdateOrderLine({storeId:1, productIdentifier:1263, quantity:1, parentBundleIdentifier:'Computer'});

    We would like to do:

    TC.addOrUpdateOrderLine(
    [
    {storeId:1, productIdentifier:1261, quantity:1, bundleIdentifier:'Computer'}, 
    {storeId:1, productIdentifier:1262, quantity:1, parentBundleIdentifier:'Computer'}, 
    {storeId:1, productIdentifier:1263, quantity:1, parentBundleIdentifier:'Computer'}
    ]);

    This way the overhead of 7 ajax calls is minimized to 1 call and the performance will increase signifigantly I think.

  • Anders Burla 2560 posts 8256 karma points
    Oct 17, 2013 @ 09:17
    Anders Burla
    100

    Hi Rody

    That is a great idea! I will have a look at that.

    I think that you can do this with the HTML API and then add the class ajaxFOrm - then Tea Commerce will post that entire form in 1 ajax call and add all the order lines. Don't know your setup - but its good practice to support non-javascript people :)

    Kind regards
    Anders

  • Rody 80 posts 280 karma points
    Oct 17, 2013 @ 09:25
    Rody
    0

    Hi Anders, 

    I've thought of that exactly and I am currently busy rewriting the page to HTML api, it is possible. 

Please Sign in or register to post replies

Write your reply to:

Draft