HTML Syntax for Cart 32
If you are writing the HTML code for your online store yourself, you will need to know the Cart32 HTML syntax. The following sections provide detailed information and example code that will enable you to generate your own HTML code or to further customize and expand upon code you have generated using the HTML Generation Tool.
Syntax for Add Items To Cart code
To implement the Add Item to Cart functionality, you must use an HTML form.
<form method=post action="https://[commerce].securedata.net/cgi-bin/cart32.exe/[clientcode]-additem">
Where [commerce] is the name of your Cart32 server and [clientcode] your Client Code. You can find both of these on SiteControl's Ecommerce page.
The following example assumes you are creating a separate form for each item. For information on adding multiple items to a form, see Adding multiple items to a form.
Field
Description and example syntax
Required fields Item name <input type=hidden name="Item" value="name of item"> Item price <input type=hidden name="Price" value="price of item"> Quantity Can be a hidden field with set quantity or text field with user set quantity.<input type=hidden name="Qty" value="1">or<input type=text size=3 name="Qty"> Optional fields Discount Modifies the price based on quantity. To set up a discount, you can use the following specification.<input type="hidden" name="discount" value="qty[+]:[+/-]price[%]">The items in brackets are optional. Each value would be separated by semi-colons.You can implement discounts by specifying an actual discount price, an adjustment (+ or -) to the product's base price or a percentage of the base price.To specify a price of $12 for an item when 1 to 5 are purchased but to discount the item to $10 when 6 or more items are purchased:<input type="hidden" name="discount" value="1-5:12;6+:10">To give any quantity of items over 3 a discount of $1 per item:<input type="hidden" name="discount" value="3+:-1">To give any quantity of items over 3 a discount of 5% per item.<input type="hidden" name="discount" value="3+:95%"> Part No An item number, code or part number used for inventory tracking or cataloging.<input type=hidden name="PartNo" value="Part Number of item"> Shipping price Applicable when using the "Built into price" shipping method. Numeric values only.<input type=hidden name="Shipping" value="price of item">You can also use this field to exclude an item from shipping. To do this set the shipping value to -1.<input type=hidden name="shipping" value="-1"> Weight Applicable only when using the "By Weight" or UPS Zone shipping method. Numeric values only.<input type=hidden name="Weight" value="weight of item"> URL URL to which the item name links.<input type=hidden name="URL" value="URL of item"> Image URL of an image that displays the list of items in the cart.<input type=hidden name="Image" value="URL of image"> Referer URL that the "Click Here To Continue Shopping" text links back to. You can specify the text in Cart32 Web Administrator's Customize Tab, All Pages section.<input type=hidden name="Referer" value="Referer of item"> Tax This field is to customize the tax value for each item. You need to specify the tax in decimal form as a percentage of that item's cost.Tax of 6%:<input type=hidden name="Tax" value=".06">Tax of 7.251%<input type=hidden name="Tax" value=".07251"> SendTo This will cause Cart32 to add the item to the cart and then display the page in the value of the SendTo tag instead of the list of items in the cart.<input type=hidden name="SendTo" value="URL of page"> Accounting Category Used for Cart32's QuickBooks support. To specify the category of this item for QuickBooks:<input type=hidden name="AccountingCategory" value="Name of Category"> Extra parameters and optionsFor each item you can have from 1 - 20 parameters. For each extra parameter, two fields are required. For parameter x your need fields named px and tx. The p stands for parameter and the t stands for type. This enables you to have fields named p1,t1 then p2,t2 then p3,t3 and so on. The options can also be used to set or modify the price, part number, tax and weight hidden fields. Drop-down list <select name="px"><option value="Option1Value">Option1Value<option value="Option2Value">Option2Value<option value="Option3Value">Option3Value</select><input type=hidden name="tx" value="d-OptionName;Option1Value;Option2Value;Option3Value"> Radio button <select name="px"><input type=radio name="Option Name" value="Option1Value">Option1Value<input type=radio name="Option Name" value="Option2Value">Option2Value<input type=radio name="Option Name" value="Option3Value">Option3Value<input type=hidden name="tx" value="r-OptionName;Option1Value;Option2Value;Option3Value"> Check box <input type=checkbox name="px">Option1Value<input type=hidden name="tx" value="c-OptionName"> Text box <input type=text name="px"><input type=hidden name="tx" value="t-OptionName"> Multi-line text box <textarea name="px" rows=5 cols=40 wrap=physical><input type=hidden name="tx" value="m-OptionName"> Hidden option <input type=hidden name="px"><input type=hidden name="tx" value="h-OptionName">Syntax for View Shopping Cart code
The View Shopping Cart code will display a list of all the items in a customer's cart. It can be invoked using the GET or POST method. Be sure to replace [commerce] and [clientcode] with the appropriate values.
Method
Description and example syntax
GET User clicks a link to view the items in the cart.<a href="https://[commerce].securedata.net/cgi-bin/cart32.exe/[clientcode]-ItemList">View Shopping Cart</a> POST User clicks a button to view the items in the cart.<form method=get action="https://
[commerce].securedata.net/cgi-bin/cart32.exe/
[clientcode]-ItemList"><input type=submit value="View Shopping Cart Text"></form>You can also pass the referer variable to the ItemList method so you can specify the Click here to continue link.
Method Description and example syntax POST <input type=hidden name="Referer" value="/mypage.html">or<input type=hidden name="Referer" value="http://
www.mysite.com/mypage.html"> GET Make sure there are no spaces in the link text.<a href="https://[commerce].securedata.net/cgi-in/
cart32.exe/[clientcode]-ItemList?Referer=
/mypage.html">View Shopping Cart Text</a>
Syntax for Empty Cart code
This code empties all of the items out of a user's shopping cart. It can be invoked in HTML in one of two ways. Be sure to replace [commerce] and [clientcode] with the appropriate values.
Method
Description and example syntax
GET User clicks a link to empty items in his/her shopping cart.<a href="https://[commerce].securedata.net/cgi-bin/cart32.exe/[clientcode]-Empty">Empty Shopping Cart Text POST User clicks a button to empty his/her shopping cart.<form method=post action="https://
[commerce].securedata.net/cgi-bin/cart32.exe
/[clientcode]-Empty">
<input type=submit value="Empty Shopping Cart Text">
</form>You can pass the referer variable to the method so you can specify the Click here to continue link.
Method
Description and example syntax
POST <input type=hidden name="Referer" value="/mypage.html">or<input type=hidden name="Referer" value="http://www.mysite.com/mypage.html"> GET Make sure there are no spaces in the link text.<a href="https://[commerce].securedata.net/cgi-bin/
cart32.exe/[clientcode]-emptycart?Referer=
/mypage.html">Empty Shopping Cart Text</a>
Adding multiple items to a form
To add multiple items to the shopping cart, put all of the items together in one HTML form.
For example:
<form method=post action="https://[commerce].securedata.net/cgi-bin/cart32.exe/[clientcode]-AddItem">
<!-- Item 1 -->
Qty <input type=text size=3 name="Qty" value=0>
T-Shirt <input type=hidden name="Item" value="T-Shirt">
Price $12.00<input type=hidden name="Price" value="12.00">
<!-- Item 2 -->
Qty <input type=text size=3 name="Qty" value=0>
Sweatshirt <input type=hidden name="Item" value=" Sweatshirt">
Price $18.00<input type=hidden name="Price" value="18.00">
<!-- Item 3 -->
Qty <input type=text size=3 name="Qty" value=0>
Cap <input type=hidden name="Item" value="Cap">
Price $10.00<input type=hidden name="Price" value="10.00">
<input type=submit value="Add Items To The Cart">
</form>The above example code adds these items to the cart if the user entered quantities greater than zero for each item. You could include a message on the page such as "Enter the quantity for the items you want to purchase and then click Add to Cart." This makes the ordering process easier than having to add each individual item.
The basic rule when adding multiple items on one form is that every item in the form needs to have all fields listed that are used in any or all of the individual items. For example, if one item has options and another does not, all items will still require p1/t1 hidden fields for options. If item #1 has three options (thus a p1/t1, p2/t2, and p3/t3 field) and item #2 has no options, then item #2 still must have the p1/t1, p2/t2, and p3/t3 fields as item #1 does. The options don't actually have to be used, but they do have to be there. You accomplish this by manipulating the form adding the options to the "option-less" item, but leaving them blank as listed below.
The following tags would be added to the "option-less" item:
<input type=hidden name=p1 value="">
<input type=hidden name=t1 value="">The first item in the form needs to have real, not blank, values. Thus, if the first item in the form is an "option-less" item, as shown above, then you must manipulate the form by adding a "dummy" item at the beginning of the form:
<input type=hidden name=Item value=Nothing>
<input type=hidden name=Price value=0>
<input type=hidden name=p1 value=1>
<input type=hidden name=t1 value=1>
<input type=hidden name=Qty value=0>
Changing price, part number, type and weight based on options
When you are creating a form to add items to the shopping cart, you can put information in the options section to have the option modify the price, tax and/or weight of an item. You use the t1, t2 ... hidden fields. The normal syntax for the tx option parameter is:
<input type=hidden name="t1" value="d-Option Name;Option Value 1;Option Value 2">
Each parameter in the value section is separated by semi-colons. The d- at the beginning of the value section stands for drop-down list. That can be r- for radio buttons or c- for a check box. The extended syntax for the option value to modify the price, tax or weight is a follows:
<input type=hidden name="t1" value="TYPE-Option Name;Option Value:PRICE=[+/-]n,PARTNO=[+/-]n,WEIGHT=[+/-]n,TAX=[+/-]n">
- Type = d- for drop down list, r- for radio button, c- for checkbox
- Option Name = the name of the option
- Option Value = the value for that option
The following examples illustrate this process:
Example: Item that sets the price based on the color. Red=$3, White=$4, Blue=$5
<input type=hidden name="Price" value="0">
<select name="p1">
<option>Red
<option>White
<option>Blue
</select>
<input type=hidden name="t1" value="d-Color;Red:price=3;White:price=4;Blue:price=5">Example: Item that sets the part number based on the color. Red=TS-Red, White= TS-Blue, Blue= TS-White
<input type=hidden name="PartNo" value="">
<select name="p1">
<option>Red
<option>White
<option>Blue
</select>
<input type=hidden name="t1" value="d-Color;Red:partno=TS-Red;White:partno=TS-White;Blue:partno=TS-White">Example: Item that increases the weight and sets the price based on the type.
<input type=hidden name="Price" value="0">
<input type=hidden name="Weight" value="3">
<select name="p1">
<option>Steel
<option>Plastic
<option>Aluminum
</select>
<input type=hidden name="t1" value="d-Type;Steel:price=10,weight=+3;Plastic:price=11,weight=+1;Aluminum:price=12,weight=+2">Example: A T-Shirt where the XL size is $2 more than the regular price and XXL is $4 more than the regular price
<form method=post action="/cgi-bin/cart32.exe/OOL-AddItem">
T-Shirt
<input type=hidden name="Item" value="T-Shirt">
Qty: <input type=text name="Qty" value="1" size=3>
Price: $15.00
<input type=hidden name="Price" value="12">
Size: <select name="p1">
<option>S $12
<option>M $12
<option>L $12
<option>XL $14
<option>XXL $16
</select>
<input type=hidden name="t1" value="d-Size;S $12;M $12;L $12;XL 14:price=+2;XXL $16:price=+4">
<input type=submit value="Add To Shopping Cart">
</form>
Syntax for adding items using products database
The process for adding items to the shopping cart using a product database is similar to the regular method for adding items to the cart, except that the only required fields are partno, qty and any options you may have.
<form method=post action="https://[commerce].securedata.net/cgi-bin/cart32.exe/[clientcode]-additem">
Where cgi-bin is your CGI bin directory and CLIENTCODE is your Cart32 client code.
Field
Description
Required fields Part No The item number, code or part number. The partno field is the key field for Cart32 to look up information. Cart32 assumes the part number is a unique field in the database.<input type=hidden name="PartNo" value="Part Number of item"> Quantity Hidden field with set quantity or text field with user set quantity.<input type=hidden name="Qty" value="1"><input type=text size=3 name="Qty"> Options The options settings are the same as for adding an item to the cart using HTML except the t1-20 values are pulled from the database, so only the p1-20 values are needed in the HTML form. Below is an example of a form that adds an item to the cart using a product database. This example assumes that you have properly set up the product database on the Products tab in the Cart32 Web Administration Tool.<form method=post action="/scripts/cart32.exe/CLIENTCODE-additem">St. Louis Blues Jersey $59.99<input type=text name=qty value="1" size=3><input type=hidden name=partno value="STL-TS1"><select name=p1><option>S<option>M<option>L<option>XL</select><input type=submit value="Add"></form>Syntax for user registration form
This code will create a link or button for the user to access his account information and review order status if the user registration feature is used. It can be invoked in HTML in one of two ways.
Method
Description
GET User clicks a link to access their user information.<a href="https://[commerce].securedata.net/cgi-bin/cart32.exe/[clientcode]-user>Log On To User Area</a> POST User clicks a button to access their user information.<form method=get action="https://[commerce]./cgi-bin/cart32.exe/[clientcode]-user"><input type=submit value="Log On To User Area"></form>