Merging LineItems

This WebDNA talk-list message is from

2003


It keeps the original formatting.
numero = 54104
interpreted = N
texte = I need to be able to combine lineitems that have the same SKU/textE and add their combined quantities. These lineitems... SKU ITEM QTY TEXTE 123 Bear 2 9 123 Bear 1 1 123 Bear 3 9 Should become... SKU ITEM QTY TEXTE 123 Bear 5 9 123 Bear 1 1 I started with the code below, but I'm kinda stuck. It doesn't look like it will combine the items unless they appear right after one another in the [lineitems] loop. [!]----- Check for same item/same shipping -----[/!] [text]dupItem=0[/text] [text]theSKU=0[/text] [text]theShipTo=0[/text] [text]theQuantity=0[/text] [orderfile cart=[cart]] [lineitems] [if ("[SKU]"="[theSKU]") & ("[textE]"="[theShipTo]")] [then] [text]dupItem=[lineindex][/text] [text]newQuantity=[math][newQuantity]+[quantity][/math][/text] [/then] [/if] [text]theSKU=[SKU][/text] [text]theShipTo=[textE][/text] [text]theQuantity=[quantity][/text] [/lineitems] [/orderfile] --------------------------------------------------------------------- Clint Davis Webmaster / Interactive Media Specialist Gray Loon Marketing Group, Inc. http://www.grayloon.com 204 Main Street | Evansville, IN 47708 | Phone:812-422-9999 --------------------------------------------------------------------- ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
  1. Re: Merging LineItems ( Clint Davis 2003)
  2. Re: Merging LineItems ( Rob Marquardt 2003)
  3. Re: Merging LineItems ( Clint Davis 2003)
  4. Re: Merging LineItems ( Rob Marquardt 2003)
  5. Merging LineItems ( Clint Davis 2003)
I need to be able to combine lineitems that have the same SKU/textE and add their combined quantities. These lineitems... SKU ITEM QTY TEXTE 123 Bear 2 9 123 Bear 1 1 123 Bear 3 9 Should become... SKU ITEM QTY TEXTE 123 Bear 5 9 123 Bear 1 1 I started with the code below, but I'm kinda stuck. It doesn't look like it will combine the items unless they appear right after one another in the [lineitems] loop. [!]----- Check for same item/same shipping -----[/!] [text]dupItem=0[/text] [text]theSKU=0[/text] [text]theShipTo=0[/text] [text]theQuantity=0[/text] [orderfile cart=[cart]] [lineitems] [if ("[SKU]"="[theSKU]") & ("[textE]"="[theShipTo]")] [then] [text]dupItem=[lineindex][/text] [text]newQuantity=[math][newQuantity]+[quantity][/math][/text] [/then] [/if] [text]theSKU=[SKU][/text] [text]theShipTo=[textE][/text] [text]theQuantity=[quantity][/text] [/lineitems] [/orderfile] --------------------------------------------------------------------- Clint Davis Webmaster / Interactive Media Specialist Gray Loon Marketing Group, Inc. http://www.grayloon.com 204 Main Street | Evansville, IN 47708 | Phone:812-422-9999 --------------------------------------------------------------------- ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Clint Davis

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

Dates and Math - Simple Subtraction (2004) more info on [setlineitems] (1997) Using EIMS instead of Emailer (1998) using showpage and showcart commands (1996) email preferences on NT (1997) Erotic Sites (1997) Success Stories (1997) shipcost (1997) problems with 2 tags (1997) Adding Fields To Db from DB Helper (1999) More on the email templates (I like it) (1997) WC2f3 (1997) WebDNA Solutions ... sorry! (1997) Password Generator (2004) absolute paths for databases? (1997) PIXO with cometsite ... and/or other plugins (1998) File Upload (1997) [taxRate] [TaxTotal] ? (1997) taxTotal (1997) Re: (1998)