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:

PCS Frames (1997) Encrypted links ... (2000) carriage returns in data (1997) Stumpted Again (1997) WebCatalog as a ListServ (1998) Summing fields (1997) problems with 2 tags shakur (1997) form data submission gets truncated (1997) [addlineitems] (1997) looking for some paid WebCatalog help (2000) looking for developers with solutions (2000) WC hosting services required (1998) WebCat2b13MacPlugin - [math][date][/math] problem (1997) WebDNA-Talk Digest mode broken (1997) Data Problem (2004) thankyou.tmpl (1997) Beta 18 (1997) Problem with [Search] inside of [Loop]? (1997) Changing Date Format in Field (1999) Max Record length restated as maybe bug (1997)