ADDING MULTIPLE ITEMS TO YOUR CART

 

Normally, as customers browse your website, they will add items to the shopping cart one at time. However, it is also possible to construct a form that will add up to 100 products on a single click.


You must set the same required fields as with other methods; your Username, the product description, a price for each item and also a quantity. If you don't post a quantity or your customer enters 0 then the item won't be added to the cart.


Each product is identified by appending a number onto the end of the field's normal name. So product1, product2 and product3 refer to the descriptions of three different items. The prices of these items are price1, price2 and price3. The quantities; qty1, qty2, qty3. The numbers have to be between 1 and 100 inclusive.

Important points:

 

 

<FORM METHOD="POST" ACTION="http://ww#.aitsafe.com/cf/addmulti.cfm">
<INPUT TYPE="HIDDEN" NAME="userid" VALUE="1234567">

<INPUT TYPE="TEXT" NAME="qty1"> Musto Ocean Jacket: Red $240.00
<INPUT TYPE="HIDDEN" NAME="product1" VALUE="Musto Ocean Jacket: Red">
<INPUT TYPE="HIDDEN" NAME="price1" VALUE="240.00">

<INPUT TYPE="TEXT" NAME="qty2">Musto Ocean Jacket: Blue $240.00
<INPUT TYPE="HIDDEN" NAME="product2" VALUE="Musto Ocean Jacket: Blue">
<INPUT TYPE="HIDDEN" NAME="price2" VALUE="240.00">

<INPUT TYPE="TEXT" NAME="qty3">Musto Ocean Jacket: Bright yellow $255.00
<INPUT TYPE="HIDDEN" NAME="product3" VALUE="Ocean Jacket: Yellow">
<INPUT TYPE="HIDDEN" NAME="price3" VALUE="255.00">

<INPUT TYPE="SUBMIT" VALUE="Buy Now">
</FORM>

 


PRODUCT OPTIONS


You can build up a list of options by posting more than one descriptor for each product. This is done by appending a pair of square brackets [ ] onto each field name:


<INPUT TYPE="HIDDEN" NAME="product1[]" VALUE="Musto Ocean Jacket">
<INPUT TYPE="HIDDEN" NAME="product1[]" VALUE="Yellow">


These two descriptions will appear in the cart separated by a comma:


Musto Ocean Jacket, Yellow


In practice, for this example, you would probably use a drop down list to select color rather than another hidden field. There is no limit to the number of options that you can post in this way.


Sometimes different options result in a different price. For example, with our Musto Jacket, small, medium and large are $150.00 but Extra Large is $170.00. Instead of posting separate price and product fields you can use a combined field productpr:


<select name="productpr1">
<option value="Musto Ocean Jacket, S:150"> Small </option>
<option value="Musto Ocean Jacket, M:150"> Medium </option>
<option value="Musto Ocean Jacket, L:150"> Large </option>
<option value="Musto Ocean Jacket, XL:170"> Extra Large </option>
</select>


The syntax for the productpr field is "Description:Price:Units:Scode:Hash" so you can't have a colon in your product descriptions. Units, Scode and Hash are optional. Any normal product or product[] fields present in the form will be appended to the end of the description.

 

URL to this page: https://www.mals-e.com/tpv.php?tp=6