[SetLineItem Parameters]values[/SetLineItem]

Changes a line item in a shopping cart.

To change a line item in a visitor's shopping cart, put a SetLineItem context into a template (alternately, you may use the ShowCart command from a URL or a FORM). Whenever WebCatalog encounters a SetLineItem context, it opens the shopping cart file and changes values in a line item (identified by its index). The item's quantity, textA-E, and cart header fields are all changeable. You can use a different price by creating a Formulas.db database. Also see Remove, Clear, ShowCart, [AddLineItem] and Purchase.

Example (normally you would put the following text into a .tpl file on your server and use a web browser to link to it):

[SetLineItem cart=5678&index=3&db=catalog.txt]quantity=4&textA=Blue[/SetLineItem]

Try It!

Shopping cart file "5678" is opened, and line item 3's quantity is changed to 4 and textA changed to "Blue" (as specified in the context above).

Here are the parameters to the SetLineItem context:

Parameter

Description

db

Product database that contains the SKU, price, and other information

index

Uniquely identifies which line item should be modified.

cart

Shopping cart file (from ShoppingCarts folder) that is to be affected

file

(alternative to cart) Shopping cart file (from any folder) that is to be affected. Unlike cart, this file can be in any folder. Specify the file URL-relative to the template.
Context value Description (these values go inside the context)

password

(Optional) In order to change the price (see below) you must provide the lineitem change password, which can be set in the preferences.

price

(Optional) Sometimes you may need to change the price of a product after it has already been added to the cart. Normally you use a formula to vary pricing, but since formulas only apply when a product if first added to the cart, this alternate technique may be needed. Remember to put the lineitem change password (see above) into the parameters.

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 copy catalog database fields such as [title] through to the order file

textB

(Optional) Same as textA above

textC

(Optional) Same as textA above

textD

(Optional) Same as textA above

textE

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

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.