Technical References - [removelineitem]

numero = 274
interpreted = N
texte = [removelineitem cart=cartID&index=3] Putting [removelineitem] in your template immediately deletes the specified line item from the specified shopping cart file. See also [addlineitem]. If the cart file is not in a ShoppingCarts folder, you may use the alternate form file=/folder/cartID instead of cart=cartID.

Take caution when removing multiple items. As you remove items, the index numbering changes. When you remove item number 2, the subsequent items move up one. For this reason, you need to figure out a way to adjust the index number. Decrement the index each time something's deleted, such as the following:

(In this example, in the incoming form the cart items each have a delete checkbox named kill_[index]. Note that in a math context, you do not need the square brackets within the expression.)
[math show=f]adjustby=0[/math][formvariables name=kill_&exact=F][math show=f]deleteitemnumber=[getchars start=6][name][/getchars]+adjustby[/math][removelineitem file=ShoppingCarts/[cart]&index=[deleteitemnumber]][math show=f]adjustby=adjustby-1[/math][/formvariables]
[removelineitem cart=cartID&index=3]

Putting [removelineitem] in your template immediately deletes the specified line item from the specified shopping cart file. See also [addlineitem]. If the cart file is not in a ShoppingCarts folder, you may use the alternate form file=/folder/cartID instead of cart=cartID.

Take caution when removing multiple items. As you remove items, the index numbering changes. When you remove item number 2, the subsequent items move up one. For this reason, you need to figure out a way to adjust the index number. Decrement the index each time something's deleted, such as the following:


(In this example, in the incoming form the cart items each have a delete checkbox named kill_[index]. Note that in a math context, you do not need the square brackets within the expression.)

[math show=f]adjustby=0[/math]

[formvariables name=kill_&exact=F]
[math show=f]deleteitemnumber=[getchars
start=6][name][/getchars]+adjustby[/math]

[removelineitem file=ShoppingCarts/[cart]&index=[deleteitemnumber]]
[math show=f]adjustby=adjustby-1[/math]

[/formvariables]


Terry Wilson

DOWNLOAD WEBDNA NOW!

Top Articles:

Technical Change History

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

WebDNA Modules

A list of the currently available modules...

Download WebDNA Applications

WebDNA applications...

WebDNA Libraries

A list of available libraries for WebDNA...

[biotype]

BioType is a behavioral biometrics WebDNA function based on ADGS research and development (from version 8...

WebDNA reference

...

Related Readings:

[replace]

Replaces each found record in a database with the new field values...

[JSONstore]

[JSONstore] stores a multidimentional JSON object into a WebDNA database...

[renamefolder]

Rename a folder in your webspace...

[deletefile]

Deleting a file from your website...

[listfields]

Lists all the fields in the specified database...

[convertchars]

[url]...