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="https://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="https://www.mals-e.com/support.php">
<input type="submit" value="Buy Now!">
</form>


Important points:

  • You can have as many forms are you like on a web page
  • You can use an image in place of the submit button
  • The only rule is, you must post AT LEAST the required variables
  • The URL for the Action part of the form is https://ww#.aitsafe.com/cf/add.cfm where # reflects the hostname your account is set up on
  • You can use HTTPS in the URL if your website is hosted using SSL/TLS.

 

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:

  • if they order 3 or less the price is $9.99,
  • if they order up to 4 more (i.e. 7), the price is $8.99,
  • if they order more than 3 + 4, the price is $6.99.

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:

  • noqty=1 the cart displays the number as text
  • noqty=2 displays a checkbox so the item can still be deleted
  • noqty=3 displays a checkbox and a quantity in text