HACKER SAFE certified sites prevent over 99.9% of hacker crime.

CLOSE WINDOW
logo
 

Try our wonderful bread!

Check all you'd like and click on "add to cart".

Rye Loaf
Wheat Loaf
Oat Loaf
White Loaf
Honey Loaf

Note: We made the first item below be a select box instead of a plain text box to illustrate drop down for quantity. Both methods can work interchangeably as you can see.

Rye Loaf
Wheat Loaf
Oat Loaf
White Loaf
Honey Loaf

This page illustrates two very simple examples of how to put more than one type of item in your basket at the same time. Using this method, you could build a more traditional "order form", or just have a logical grouping of items likely to be ordered together.

In the above example, we assume that a customer wants to buy bread. In all likelyhood, they will want more than one type. To avoid them having to do four "add to cart" functions to buy four types of bread, we offer this method.

We discourage you from building large, single page order forms with all you products on it, although it will work just fine from a technical point of view as far as Americart is concerned. If a single form gets too large, it will start to "act up" on some shopper's browsers, as available memory is exhausted. Instead, we encourage either single item "add to cart"s or logical groupings like the above.

There are coding differences to make multi-item submissions work correctly. We cannot, of course, have all products in a grouping be "name=item", since they would overwrite each other. Instead, we make the "item" variable name be "item_somethingunique". Item part numbers work well for the something-unique part of the variable name. "op" variables must be tagged the same way. "op1_same-unique-as-item". You MUST have the underscore character after "item" and "op1" for it to be parsed correctly.

View the source of this document now, and examine example one.

Example one uses check boxes to "turn on" an item for adding to the cart. It's a really basic example, but note the "name=item_xxxx" convention. Also notice the input type=hidden name=item value="a-1357". The form will work ok without it, but if someone clicks "add to cart" without checking any boxes, Americart will still know the path to your account.

Example two uses an op variable. Notice that although the quantity field of the individual product contains "op1", the actual input type=text size=2 name=op1_rye value="0" uses op1_rye. The "rye" matches the suffix of the "item_rye". Perhaps we've belabored this point, but it is the only real difference between single and multiple item submission besides the fact the all items in a "multi" must be inside a single form /form.

Reminder: DO NOT put "op1_same-unique-as-item" inside the item string quantity field, just op1. name=item_rye value="a-1357^rye^loaf of Rye^2.22^op1" See? Just plain "op1" in the quantity field.

There are many ways to structure this method. The above are just two. You can have select pop-ups, text fields, radio buttons, or anything you wish, just like the single item method.


End of page