Re: Modify instead of Add

This WebDNA talk-list message is from

2000


It keeps the original formatting.
numero = 31629
interpreted = N
texte = Thanks-That was an easy find. Search Messages for duplicate skuSorta made my own routine out of a few examples, if anyone is curious this is what I did.[showif [action]=Add] [text]incomingSKU=[sku][/text] [math show=f]new_quantity=[quantity][/math] [LineItems] [ShowIf [SKU]=[incomingSKU]] [math show=f]new_quantity=new_quantity+[quantity][/math] [SetLineItem db=wiring.db&cart=[cart]&index=[lineindex]]quantity=[new_quantity][/SetLineItem] [text]dupeitem=1[/text] [/ShowIf] [/LineItems] [ShowIf [dupeitem]!1] [addlineitem db=wiring.db&cart=[cart]&sku=[url][sku][/url]]quantity=[quantity][/addlineitem] [/ShowIf] [/showif]-David> >I'm using the following logic on a shopping cart page. >> >>This is my first day with webcatalog so bear with me :) >> >>[showif [action]=Add] >> [addlineitem >>db=wiring.db&cart=[cart]&sku=[url][sku][/url]]quantity=1[/addlineitem] >>[/showif] >> >>[showif [action]=Remove] >>[removelineitem db=wiring.db&cart=[cart]&index=[index]] >>[/showif] >> >>[showif [action]=quantity] >>[SetLineItem >>db=wiring.db&cart=[cart]&index=[index]]quantity=[new_quant][/SetLineItem] >>[/ShowIf] >> >> >>The quantity logic basically works by re-calling the cart.tpl with a >>modified (user entered) >>quantity. >> >>But... what if I add an item, go back to browsing my catalog, browse >>to an identical item >>in my catalog, and click the add button again. Yes, I do want to buy >>a 2nd whatever, but >>didn't know it the first time I hit the cart page. >> >>Now when I go to my cart I have two identical line items for the >>same product. >>Does anyone have a set of tags (or the logic for), reading through a >>cart, checking >>to see if two sku's match, adding the quantities together, and >>processing it as a >>setlineitem instead of an addlineitem? >> >>thanks, >> >>-David >David, this is in the mailing list archives somewhere. >-- > > >Micheal O Shea Email:micheal@com4u.ch >com4u.ch http://www.com4u.ch >Breitistrasse 7B PGP key available upon request. > >CH-5506 Maegenwil Tel: +41 62 896 46 26 >Switzerland > >------------------------------------------------------------- >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 > ------------------------------------------------------------- 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: Modify instead of Add (David Gersh 2000)
  2. Modify instead of Add (David Gersh 2000)
  3. Re: Modify instead of Add (Michael O Shea 2000)
Thanks-That was an easy find. Search Messages for duplicate skuSorta made my own routine out of a few examples, if anyone is curious this is what I did.[showif [action]=Add] [text]incomingSKU=[sku][/text] [math show=f]new_quantity=[quantity][/math] [lineitems] [ShowIf [SKU]=[incomingSKU]] [math show=f]new_quantity=new_quantity+[quantity][/math] [SetLineItem db=wiring.db&cart=[cart]&index=[lineindex]]quantity=[new_quantity][/SetLineItem] [text]dupeitem=1[/text] [/ShowIf] [/LineItems] [ShowIf [dupeitem]!1] [addlineitem db=wiring.db&cart=[cart]&sku=[url][sku][/url]]quantity=[quantity][/addlineitem] [/ShowIf] [/showif]-David> >I'm using the following logic on a shopping cart page. >> >>This is my first day with webcatalog so bear with me :) >> >>[showif [action]=Add] >> [addlineitem >>db=wiring.db&cart=[cart]&sku=[url][sku][/url]]quantity=1[/addlineitem] >>[/showif] >> >>[showif [action]=Remove] >>[removelineitem db=wiring.db&cart=[cart]&index=[index]] >>[/showif] >> >>[showif [action]=quantity] >>[SetLineItem >>db=wiring.db&cart=[cart]&index=[index]]quantity=[new_quant][/SetLineItem] >>[/ShowIf] >> >> >>The quantity logic basically works by re-calling the cart.tpl with a >>modified (user entered) >>quantity. >> >>But... what if I add an item, go back to browsing my catalog, browse >>to an identical item >>in my catalog, and click the add button again. Yes, I do want to buy >>a 2nd whatever, but >>didn't know it the first time I hit the cart page. >> >>Now when I go to my cart I have two identical line items for the >>same product. >>Does anyone have a set of tags (or the logic for), reading through a >>cart, checking >>to see if two sku's match, adding the quantities together, and >>processing it as a >>setlineitem instead of an addlineitem? >> >>thanks, >> >>-David >David, this is in the mailing list archives somewhere. >-- > > >Micheal O Shea Email:micheal@com4u.ch >com4u.ch http://www.com4u.ch >Breitistrasse 7B PGP key available upon request. > >CH-5506 Maegenwil Tel: +41 62 896 46 26 >Switzerland > >------------------------------------------------------------- >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 > ------------------------------------------------------------- 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 David Gersh

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:

Speed Optimization - Mac (1997) multiple databases (1997) Wanted to buy: WebDNA 6 license (2007) RE: Tax and ShipCost Problem (1997) More on the email templates (1997) [TaxableTotal] - not working with AOL and IE (1997) Not really WebCat (1997) charge.com (2005) OT: Unknown Webstar Error ruining presentation?! (2001) WebDNA 6.0 & MAC OS X Server 10.4.10 (2007) How do I handle extra spaces? (2002) Calendar Snippet (1998) RequiredFields template (1997) [WebDNA] ListMIMEHeaders (2008) Cart Template (1997) WebCat2 - Getting to the browser's username/password data (1997) Pref settings? (1998) Faxing orders in place of email (1997) WC2b15 - [HTMLx]...[/HTMLx] problems (1997) WCS Newbie question (1997)