Re: Item in Cart 2 times - Any code?

This WebDNA talk-list message is from

2000


It keeps the original formatting.
numero = 28882
interpreted = N
texte = On 3/10/00 4:04 pm, Jesse Proudman so noted...>I need an easy bit of WebCat code to see if an item is already in a cart so >I don't add the same thing twice. Any one?Here's what I use -- if a duplicate item gets added, the quantity selected of the new item gets added to the item already in the cart. This doesn't do anything to update the items price (since I do that later in this case) but could be added to the [setLineItem] with an appropriate price-changing password.The item being added is passed from the form in [skuSelect], the quantity as [quantitySelect][!] -- check for duplicates [/!] [math show=f]dupeItem=0,nuQuantity=[quantitySelect][/math] [orderfile cart=[cart]] [lineitems] [showif [sku]=[skuSelect]] [math show=f]dupeItem=[quantity][/math] [math show=f]nuQuantity=nuQuantity+[quantity][/math] [math show=f]tempdex=[lineindex][/math] [/showif] [/lineitems] [/orderfile][!] -- new item if no dupes [/!] [showif [dupeItem]=0] [addLineItem cart=[cart]&sku=[skuSelect]&db=product.db]quantity=[nuQuantity][/addLineIte m] [/showif][!] -- change quantity if there is a dupe [/!] [showif [dupeitem]!0] [setLineItem cart=[cart]&index=[tempdex]&db=product.db]quantity=[nuQuantity][/setLineIte m] [/showif] Rob Marquardt Designer/Resident Wirehead Toast Design800 Washington Avenue North Minneapolis MN 55401 612.330.9863 v 612.321.9424 f www.toastdesign.com ------------------------------------------------------------- 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 Associated Messages, from the most recent to the oldest:

    
  1. Re: Item in Cart 2 times - Any code? (Rob Marquardt 2000)
  2. Item in Cart 2 times - Any code? (Jesse Proudman 2000)
On 3/10/00 4:04 pm, Jesse Proudman so noted...>I need an easy bit of WebCat code to see if an item is already in a cart so >I don't add the same thing twice. Any one?Here's what I use -- if a duplicate item gets added, the quantity selected of the new item gets added to the item already in the cart. This doesn't do anything to update the items price (since I do that later in this case) but could be added to the [setlineitem] with an appropriate price-changing password.The item being added is passed from the form in [skuSelect], the quantity as [quantitySelect][!] -- check for duplicates [/!] [math show=f]dupeItem=0,nuQuantity=[quantitySelect][/math] [orderfile cart=[cart]] [lineitems] [showif [sku]=[skuSelect]] [math show=f]dupeItem=[quantity][/math] [math show=f]nuQuantity=nuQuantity+[quantity][/math] [math show=f]tempdex=[lineindex][/math] [/showif] [/lineitems] [/orderfile][!] -- new item if no dupes [/!] [showif [dupeItem]=0] [addLineItem cart=[cart]&sku=[skuSelect]&db=product.db]quantity=[nuQuantity][/addLineIte m] [/showif][!] -- change quantity if there is a dupe [/!] [showif [dupeitem]!0] [setLineItem cart=[cart]&index=[tempdex]&db=product.db]quantity=[nuQuantity][/setLineIte m] [/showif] Rob Marquardt Designer/Resident Wirehead Toast Design800 Washington Avenue North Minneapolis MN 55401 612.330.9863 v 612.321.9424 f www.toastdesign.com ------------------------------------------------------------- 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 Rob Marquardt

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:

Textarea Breaks (2000) Purchased cart being overwritten - still !?? (1997) Secure Server (1997) raw=T is broken in [include] (1997) Hello??? (1997) AOL displays strange header info (2000) WebDNA Solutions ... sorry! (1997) RE: Formulas.db + Users.db (1997) # of real domains on 1 web server (1997) Random sort is not random at all..... (2000) form crasehes server (1997) Carts & cookies (1999) HELP WITH DATES (1997) [WebDNA] Sorry WebDNA server not running (2014) Bug Report, maybe (1997) [WebDNA] Windows Installation (2019) Not reading code (1997) SQL Support (2000) WebCat2 Append problem (B14Macacgi) (1997) Email template names (1997)