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:

WebCat2b13MacPlugIn - [include] doesn't allow creator (1997) [LOOKUP] (1997) Bad creator codes which cause access denied errormessage (1997) Loosing Quantity (2000) Uh...can someone help me out with the b10? (1997) WebCatalog Features (1997) Serving images from databases (1998) Serving images from databases (1998) Can this be done? (2003) [WebDNA] Feature Request: [returnhtml] (2016) Google MAP URLs (2006) Universal root for WC errors? (1997) 2.0 Info (1997) Dates - Search and Sorting (1999) Search/sort in URL Was: GuestBook example (1997) Sorting by SKU Not Working (1998) Can't Update records (1997) Cart questions (1997) [createfolder] & [deletefolder] (1997) Template Encrypt Speed (1998)