Technical References - [addlineitem]

Adds a product to the specified shopping cart

numero = 222
interpreted = N
texte = [addlineitem Parameters]values[/addlineitem] To add products to a visitor's shopping cart, put an [addlineitem] context into a template. Whenever WebDNA encounters an [addlineitem] context, 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. Example:
[addlineitem cart=5678&sku=1234&db=catalog.db][!][/!]quantity=5&[!][/!]textA=Red[!][/!][/addlineitem]
The database "catalog.db" is searched, and sku 1234 is found. Shopping cart file "5678" opens, and a new line item is added to the bottom of the list, with a quantity of 5 and textA set to "Red" (as specified in the context above). The price is taken from the database's price field (or, if a formula for [price] is available in formulas.db, the price is calculated using that formula). Note: you may also add line items to order files that are not inside the ShoppingCarts folder. Using file=/folder/folder/cartname instead of cart=cartname, you can affect any order file in any folder. Note: you may add a maximum of 100 line items to a shopping cart. Here are the parameters to the [addlineitem] context:
ParameterDescription
dbProduct database containing the SKU, price, and other information.
skuUniquely identifies which product should be added to the cart.
cartAffected shopping cart file (from ShoppingCarts folder)
filealternative to cart) Alternate affected shopping cart file (from any folder). Unlike cart, this file can be in any folder. Specify the file URL-relative to the template.
Context valuesDescription (these values go inside the context)
password(Optional) In order to change the price (see "price") 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 while adding it to the cart. Normally you use a formula to vary pricing, but sometimes this alternate technique is preferred. Remember to put the line item change password into the parameters. There is a slight security risk when using this technique, as a hacker could create a URL containing their own price values
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 so they may be viewed later without needing the original database to look for the value of [title].
textB ... textZSame as textA above.
quantity(Optional) Indicates quantity of this item. This quantity is used when calculating subtotals, 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 FieldYou may set any shopping cart header field (such as name, taxrate, address1, etc.) at the same time you add a product to the cart. Header fieldnames are different from the line item fieldnames, and WebDNA will know they are header fields.
[addlineitem Parameters]values[/addlineitem]

To add products to a visitor's shopping cart, put an [addlineitem] context into a template. Whenever WebDNA encounters an [addlineitem] context, 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.

Example:

[addlineitem cart=5678&sku=1234&db=catalog.db][!]
[/!]quantity=5&[!]
[/!]textA=Red[!]
[/!][/addlineitem]

The database "catalog.db" is searched, and sku 1234 is found. Shopping cart file "5678" opens, and a new line item is added to the bottom of the list, with a quantity of 5 and textA set to "Red" (as specified in the context above). The price is taken from the database's price field (or, if a formula for [price] is available in formulas.db, the price is calculated using that formula).

Note: you may also add line items to order files that are not inside the ShoppingCarts folder. Using file=/folder/folder/cartname instead of cart=cartname, you can affect any order file in any folder.

Note: you may add a maximum of 100 line items to a shopping cart.

Here are the parameters to the [addlineitem] context:
ParameterDescription
dbProduct database containing the SKU, price, and other information.
skuUniquely identifies which product should be added to the cart.
cartAffected shopping cart file (from ShoppingCarts folder)
filealternative to cart) Alternate affected shopping cart file (from any folder). Unlike cart, this file can be in any folder. Specify the file URL-relative to the template.
Context valuesDescription (these values go inside the context)
password(Optional) In order to change the price (see "price") 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 while adding it to the cart. Normally you use a formula to vary pricing, but sometimes this alternate technique is preferred. Remember to put the line item change password into the parameters. There is a slight security risk when using this technique, as a hacker could create a URL containing their own price values
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 so they may be viewed later without needing the original database to look for the value of [title].
textB ... textZSame as textA above.
quantity(Optional) Indicates quantity of this item. This quantity is used when calculating subtotals, 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 FieldYou may set any shopping cart header field (such as name, taxrate, address1, etc.) at the same time you add a product to the cart. Header fieldnames are different from the line item fieldnames, and WebDNA will know they are header fields.

DOWNLOAD WEBDNA NOW!

Top Articles:

Technical Change History

This Technical Change History provides a reverse chronological list of WebDNA changes...

WebDNA Libraries

A list of available libraries for WebDNA...

AWS Raw WebDNA LAMP-Plus WebServer

Amazon Web Services (AWS) README for Machine Image ID...

WebDNA Modules

A list of the currently available modules...

Tips and Tricks

A list of user-submitted tips ...

F.A.Q

A compilation of some user's questions...

Related Readings:

[deletefolder]

Deletes a folder from your website...

[convertchars]

[url]...

[hide]

Prevents WebDNA to return hidden parts of your code to apache (from version 8...

[listfiles]

When listing files...

[math]

[math] calculates equations using numbers...

[lowercase]

Changes all upper case letters to lower case...