USING AN HTML FORM

 

You can add items to your cart using an HTML form post instead of an ordinary hyperlink. You must set the same values that you set in a hyperlink; your Username, the product description and a price. You can also post a quantity and a url for a Continue shopping button in the cart.


You can use the full range of GUI form elements; radio buttons, check boxes and drop down lists.


<form action="http://ww#.aitsafe.com/cf/add.cfm" method="post">
<input name="userid" type="hidden" value="12345678">
<input name="product" type="hidden" value="Oceanmaster jacket">
<input name="price" type="hidden" value="159">
<input name="return" type="hidden" value="www.mals-e.com/support.php">
<input type="submit" value="Buy Now!">
</form>


Important points:

 

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="product[]" VALUE="Musto Ocean Jacket">
<INPUT TYPE="HIDDEN" NAME="product[]" VALUE="Yellow">


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


Musto Ocean Jacket, Yellow


In practice you will probably want to use a drop down selection:


<INPUT TYPE="HIDDEN" NAME="product[]" VALUE="Musto Ocean Jacket">
<select name="product[]">
   <option value="Small"> Small </option>
   <option value="Medium"> Medium </option>
   <option value="Large"> Large </option>
</select>


There is no limit to the number of options that you can post using a field named product[].


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="productpr">
   <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.

 

Quantity discounts

You might want to offer a discount on a product as people buy more of it. To do this, instead of a single price, you pass in an array of price points in a field called discountpr. The syntax for the field is a little complicated at first glance.


You can have an unlimited number of prices points, each one is separated by a comma. Each price point has a range and a price for the product, separated by a colon.


<INPUT TYPE="HIDDEN" NAME="discountpr" VALUE="3,9.99:4,8.99:0,6.99">


The above example means:


The last range always means "more than". It is set to 0 in the example above but in fact what you enter is simply ignored.


With discountpr the cart checks to see if a product being added to the cart is the same as one it already has in the order. It does that using the scode field if it is present or the product's description (product) if it is not. If the product is already in the order then it increments the quantity instead of adding a new line item.


 

Removing the quantity box


There may be occasions when you don't want a quantity box in the cart. For example if the product is donation or you only have a limited quantity of it.


You can do this using a field named noqty in your Buy Now links. There are three possible values:

 

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