Using the ShopSite Multi Add to Cart Function
This topic contains 0 replies, has 1 voice, and was last updated by Anonymous 16 years, 7 months ago.
-
AuthorPosts
-
February 24, 2009 at 4:24 pm #48665
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.shtmlYou 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 --]
-
AuthorPosts
You must be logged in to reply to this topic.