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:

WebCatalog can't find database (1997) WebCat2 beta 11 - new prefs ... (1997) counting characters and/or words (1997) Web Merchant process after credit card clears (1998) textarea to page display (1998) URGENT: WebCatalog 2.0 (1998) Cool new site (1996) 2.0Beta Command Ref (can't find this instruction) (1997) Bug in WebCat, (2000) dos performance (1998) Backwards list behavior ... (1997) Netscape 3.01 can't see db in form (was problems problemsproblems) (1997) FREE Stuff .. (2003) WebCat2b13MacPlugIn - [showif][search][/showif] (1997) database size? (1997) SiteEdit NewFile.html ? (1997) File Upload (1997) Newbie search question (between two dates) (2001) Checking two required fields (1998) Displaying xx number of characters (1997)