Using the ShopSite Multi Add to Cart Function

Forum Forums Tutorials Using the ShopSite Multi Add to Cart Function

This topic contains 0 replies, has 1 voice, and was last updated by  Anonymous 12 years, 9 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #48665

    Anonymous
    Participant

    With specially-designed page and product templates, you can let customers check boxes for items that they want to buy and then click one add to cart button to add them all to the shopping cart. The ShopSite help documentation and custom template cookbook give you detailed examples on how to accomplish this. Reference:

    http://www.shopsite.com/help/10.0/en-US/install/custom.template.multi-add.html
    http://www.shopsite.com/templates/cookbook/tips-multiaddtocart-page.shtml

    You can have the boxes checked by default by adding the word ‘checked’ to the product template at the end of the following line:

    <P><input type=checkbox name=itemnum value=[-- PRODUCT.RECORDNUMBER --] checked>

    The drawback to this implementation is that if the customer leaves all of the boxes checked, a zero quantity item will be added to the cart for every item on the screen without a specific quantity ordered. The following two examples provide ways around this drawback.

    Using the following example code in your product template will allow the box to become checked automatically, based on the quantity box changing in value:

    [-- DEFINE PRODUCT --]
    
    <P><input id="[-- PRODUCT.RECORDNUMBER --]_check" type=checkbox name=itemnum value=[-- PRODUCT.RECORDNUMBER --]>
    
    [--PRODUCT.Name--]
    [--PRODUCT.Price--]
    
    [-- IF product.DisplayOrderQuantity? --]
    Quantity <input id="[-- PRODUCT.RECORDNUMBER --]_quantity" type=text size="2" name="[-- PRODUCT.RECORDNUMBER --]:qnty"
    value="1" onchange="var checkVal = document.getElementById('[-- PRODUCT.RECORDNUMBER --]_check'); (this.value > 0 && checkVal.checked==false ) ? checkVal.checked=true : checkVal.checked=false;">
    [-- END_IF --]
    
    <BR>[-- Product.ProductDescription --]
    
    [-- IF PRODUCT.DisplayOrderingOptions --]
    <BR>
    [-- PRODUCT.OptionText --]
    [-- ORDER_OPTION_MENU LINE --]
    [-- END_IF --]
    
    </P>
    [-- END_DEFINE PRODUCT --]

    This example code will allow the checkboxes to be hidden completely, and would only add those items with a non-zero quantity to the cart:

    [-- DEFINE PRODUCT --]
    <p>
    <input id="[-- PRODUCT.RECORDNUMBER --]_check" type=checkbox name=itemnum value="[-- PRODUCT.RECORDNUMBER --]" style="visibility: hidden;">
    [--PRODUCT.Name--]
    [--PRODUCT.Price--]
    [-- IF product.DisplayOrderQuantity? --]
    Quantity <input id="[-- PRODUCT.RECORDNUMBER --]_quantity" type=text size="2" name="[-- PRODUCT.RECORDNUMBER --]:qnty"
    value="0" onchange="var checkVal = document.getElementById('[-- PRODUCT.RECORDNUMBER --]_check'); (this.value > 0 && checkVal.checked==false ) ? checkVal.checked=true : checkVal.checked=false;">
    [-- END_IF --]
    
    [-- Product.ProductDescription --]
    
    [-- IF PRODUCT.DisplayOrderingOptions --]
    
    [-- PRODUCT.OptionText --]
    [-- ORDER_OPTION_MENU LINE --]
    [-- END_IF --]
    </p>
    [-- END_DEFINE PRODUCT --]

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.