Add?db=DatabaseName&cart=[cart]&sku=xx&quantity=xx

Adds a product to the specified shopping cart.

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):

http://yourserver.com/xx.tpl?command=Add&db=SomeDatabase.db&sku=1234&cart=5678&quantity=5

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

(Optional) Tells how many of this SKU should be added to the cart. This quantity is used when calculating totals, unitShipCost, etc.

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).

Header Field

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

You may force the visitor to enter something into a field by using the RequiredFields parameter in the URL. Setting RequiredFields=field1+field2+field3 will display an error message if the visitor forgets to enter some text into any of those 3 fields. RequiredFields works for all commands, not just this one.