Copied to clipboard

Flag this post as spam?

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


  • Tom Madden 252 posts 454 karma points MVP 4x c-trib
    Mar 31, 2021 @ 19:33
    Tom Madden
    0

    Adding multiple products on Add to Basket

    Hi,

    is there a simple way to add multiple products to the basket in one call, without creating a bundle?

    I want to give the option to select one or more add-on products as shown in the red square below. The products will vary by product category and will change from time to time.

    Just wondering if there's a tried and tested way to do this before I dig into it myself.

    thanks

    t

    enter image description here

  • Tom Madden 252 posts 454 karma points MVP 4x c-trib
    Mar 31, 2021 @ 19:58
    Tom Madden
    0

    Actually looking into this, perhaps creating a bundle is the way to do this. My only concern is the grouping of products so if someone added a few items and selected the add on under one of them then later removed the parent product they may remove the add-on product without realising.

    I'll investigate further,

    regards

    t

  • Matt Brailsford 4123 posts 22194 karma points MVP 9x c-trib
    Apr 01, 2021 @ 08:16
    Matt Brailsford
    0

    Hey Tom,

    You should be able to use the HTML API to add multiple products at the same time. To do so you can follow closely the bundle example, but just miss out the bundle parts.

    <form method="post" action="/base/TC/FormPost.aspx">
      <input name="AddOrUpdateOrderLine" value="productIdentifier : productIdentifier_1, quantity : quantity_1" type="hidden" />
      <input name="AddOrUpdateOrderLine" value="productIdentifier : productIdentifier_2, quantity : quantity_2" type="hidden" />
      <input name="storeId" value="1" type="hidden" />
      <input name="productIdentifier_1" value="1072" type="hidden" />
      <input name="productIdentifier_2" value="1073" type="hidden" />
      <input name="quantity_1" value="1" type="text" />
      <input name="quantity_2" value="2" type="text" />
      <input value="Add products" type="submit" />
    </form>
    

    They key is to add multiple input fields, and use the AddOrUpdateOrderLine mapping API to map to specific input fields for each item being added.

  • Tom Madden 252 posts 454 karma points MVP 4x c-trib
    Apr 01, 2021 @ 10:33
    Tom Madden
    0

    brilliant, thanks Matt

Please Sign in or register to post replies

Write your reply to:

Draft