Add?db=DatabaseName&cart=[cart]&sku=xx&quantity=xx
To add products to a visitor's shopping cart, click a URL containing the Add command (alternately, you may embed an [AddLineItem] context in a template). Whenever WebCatalog receives an Add command, it opens the shopping cart file (creating a new one if necessary) and adds the product (identified by its SKU) to the end of the LineItems in the shopping cart. The item's price, taxable, canEmail, and unitShipCost information is found by looking for the values of those fields in the product database. You can use a different price by creating a Formulas.db database. Also see Remove, Clear, ShowCart, and Purchase.
Example (normally you would link to a URL or form containing the following information):
Try It!
The database "SomeDatabase.db" is opened, and sku 1234 is found. Shopping Cart file "5678" is opened, and a new line item is added to the bottom of the list, with a quantity of 5 (as specified in the command above), and a price taken from the database's price field. The page sent back to the browser will be xx.tpl, which typically contains a [LineItems] loop to display the current items in the cart.
Here are the parameters to the Add command:
| Parameter | Description |
|---|---|
|
db |
Product database that contains the SKU, price, and other information |
|
sku |
Uniquely identifies which product should be added to the cart. |
|
cart |
Shopping cart file that is to be affected |
| Optional Parameters | Description |
|
textA |
(Optional) Extra information of any kind that you want associated with this line item. Often used to store extra product information, such as "shoe size" or "color". Also used to pass catalog database fields such as [title] through to the order file |
|
textB |
Same as textA above |
|
textC |
Same as textA above |
|
textD |
Same as textA above |
|
textE |
Same as textA above |
|
quantity |
|
|
taxable |
(Optional) "T" or "F". Overrides "taxable" field in the database - normally the information about the item's taxable status is taken from a field called "taxable" |
|
canEmail |
(Optional) "T" or "F". Overrides "canEmail" field in the database - normally the information about the item's canEmail (electronically deliverable) status is taken from a field called "canEmail" |
|
unitShipCost |
(Optional) A number indicating the item's price for shipping. Overrides "unitShipCost" field in the database - normally the information about the item's unitShipCost status is taken from a field called "unitShipCost". ShipTotal and GrandTotal use this number (multiplied by quantity) to determine the total shipping and grand total. |
|
template |
Template of HTML to be displayed after adding the new item to the cart (typically a shopping cart template thanking the visitor for choosing a product to buy). |
| You may set any shopping cart header field (such as Name, taxRate, Address1, etc.) at the same time you add a product to the cart. | |
|
RequiredFields |
|