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][SETLINEITEMcart=[cart]&index=[MATH]LINE[/MATH]&db=Your.db]quantity=[MATH]QTY+1[/MATH][/SETLINEITEM][/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.comInternet 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:
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][SETLINEITEMcart=
[cart]&index=
[math]LINE[/MATH]&db=Your.db]quantity=
[math]QTY+1[/MATH][/SETLINEITEM][/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.comInternet 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:
WebCat Hosting - Pricing Question (2002)
Double Spacing in Mails from Sendmail (2002)
email program problem (1998)
Need relative path explanation (1997)
Can WC remember people? (1998)
WC 2.0 frames feature (1997)
HELP-1!!! (1998)
default value from Lookup (was Grant, please help me) (1997)
[no_cache]?! (2000)
WebCat and search engines (1998)
[sendmail]- bcc? (1998)
Protect and Serve (1999)
File Uploads... (1997)
WebCatalog 4.0.1b1 is now available (2000)
Requiring that certain fields be completed (1997)
Still More on EudoraPro Email (1998)
Protecting Images (2003)
AppleScript question (1997)
[ModDate] & [ModTime] ? (1997)
New site announcement + Showing once on a founditems (1997)