duplicate items in cart

This WebDNA talk-list message is from

1998


It keeps the original formatting.
numero = 19725
interpreted = N
texte = Regarding the problem below, can someone please tell me the placement of the code? Thank you. Crys> 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]MichaelJer 29:11 For I know the thoughts I think towards you, says the Lord, thoughts of peace and not of evil, to give you a future and a hope. Associated Messages, from the most recent to the oldest:

    
  1. Re: duplicate items in cart (PCS Technical Support 1998)
  2. duplicate items in cart (crys 1998)
Regarding the problem below, can someone please tell me the placement of the code? Thank you. Crys> 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]MichaelJer 29:11 For I know the thoughts I think towards you, says the Lord, thoughts of peace and not of evil, to give you a future and a hope. crys

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:

[WebDNA] Fails to recognize comma-separated db (2010) Unexpected error (1997) [WebDNA] Using webdna to automate ftp on a Windows server (2012) WebMerchant %s error using Authorize.Net (2000) Re:affiliate marketing program (1998) Use of & in text areas.... (1998) WebCat2: multiple currency support (1997) searchable list archive (1997) [urgent] Phone number at SM (2006) [WebDNA] Mail not sending (2018) RE: New WebCatalog Version !!! (1997) shipCost not working v2.1b4 (1997) Calculating multiple shipping... (1997) Redirect (2000) Announcement-WebCatalog 2.0 Released (1997) Searching an Email database (1997) blank page from template (1997) Repeating Fields (1997) Introduction/Tutorial/QuickStart (1997) [OT] Redhat 6.1 (2003)