Re: Duplicate Items in the Cart

This WebDNA talk-list message is from

1998


It keeps the original formatting.
numero = 17688
interpreted = N
texte = At 4:13 AM -0800 5/15/98, Paul Willis is rumored to have typed: > Hi > > On 11/3/98 Grant wrote: > > >You can change your templates so that you first look through all the > >[LineItems] for a matching sku, and if one matches you do a [SetLineItem] > >to increment the quantity, but if none match then you do an [AddLineItem] > >to put another item in the cart. > > > > > Does anyone have some code that I can look at that does this? I've tried > various ways to get this to work but I am getting nowhere fast.Here's one way to do it:[ORDERFILE cart=[CART]] [LINEITEMS] [SHOWIF [ITEMADDED]=[SKU]] [MATH SHOW=F]HERE=1[/MATH] [MATH SHOW=F]LINE=[LINEINDEX][/MATH] [MATH SHOW=F]QTY=[quantity][/MATH] [/SHOWIF] [/LINEITEMS] [/ORDERFILE][SHOWIF [MATH]HERE[/MATH]=1] [SETLINEITEM cart=[cart]&index=[MATH]LINE[/MATH]&db=Your.db]quantity=[MATH]QTY+1[/MATH][/SETL INEITEM] [/SHOWIF] [HIDEIF [MATH]HERE[/MATH]=1] [SADDLINEITEM cart=[cart]&sku=[ITEMADDED]&db=Your.db]quantity=1[/ADDLINEITEM] [/HIDEIF]MichaelMichael Winston *By e-mail!: michaelw@dhorse.com Internet Coordinator *By web!: http://www.dhorse.com/ Dark Horse Comics, Inc. *By fax!: 503/654/9440 Associated Messages, from the most recent to the oldest:

    
  1. Re: Duplicate Items in the Cart (Michael Winston 1998)
  2. Re: Duplicate Items in the Cart (Paul Willis 1998)
  3. Re: Duplicate Items in the Cart (Grant Hulbert 1998)
  4. Duplicate Items in the Cart (Jose A. Gordo 1998)
At 4:13 AM -0800 5/15/98, Paul Willis is rumored to have typed: > Hi > > On 11/3/98 Grant wrote: > > >You can change your templates so that you first look through all the > >[lineitems] for a matching sku, and if one matches you do a [setlineitem] > >to increment the quantity, but if none match then you do an [addlineitem] > >to put another item in the cart. > > > > > Does anyone have some code that I can look at that does this? I've tried > various ways to get this to work but I am getting nowhere fast.Here's one way to do it:[ORDERFILE cart=[cart]] [lineitems] [SHOWIF [ITEMADDED]=[SKU]] [MATH SHOW=F]HERE=1[/MATH] [MATH SHOW=F]LINE=[LINEINDEX][/MATH] [MATH SHOW=F]QTY=[quantity][/MATH] [/SHOWIF] [/LINEITEMS] [/ORDERFILE][SHOWIF [math]HERE[/MATH]=1] [SETLINEITEM cart=[cart]&index=[math]LINE[/MATH]&db=Your.db]quantity=[math]QTY+1[/MATH][/SETL INEITEM] [/SHOWIF] [HIDEIF [math]HERE[/MATH]=1] [SADDLINEITEM cart=[cart]&sku=[ITEMADDED]&db=Your.db]quantity=1[/ADDLINEITEM] [/HIDEIF]MichaelMichael Winston *By e-mail!: michaelw@dhorse.com Internet Coordinator *By web!: http://www.dhorse.com/ Dark Horse Comics, Inc. *By fax!: 503/654/9440 Michael Winston

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:

Problems adding stuff to the shopping cart. (1997) Protect (1997) Help with Shipping Costs (1997) Resume Catalog ? (1997) [addlineitems] (1997) Frames and WebCat (1997) Form Submition (2003) Math, Multiple Equasions and Show/Hide (1998) [lookup] [search] Issue (2005) Professional WebDNA Hosting Solutions (2005) A Trigger Question (2000) Re:2nd WebCatalog2 Feature Request (1996) External Images (1998) [taxrate] question (1997) Lost Field (1998) customizing the color of user's pages (1997) Why do extra quotation marks sometimes appear in my databases? (1998) [ELSEIF] was hideif [x]=1,2,3..: (2003) [SearchString] usage (1997) Dumb Question about Docs (1997)