Re: Replacing entry

This WebDNA talk-list message is from

1998


It keeps the original formatting.
numero = 17947
interpreted = N
texte = At 8:58 AM -0800 5/28/98, Mícheál O Sé is rumored to have typed: > Hi folks, > What is the best way to subtract from a product.db? > I want webcat to subtract the number of products purchased from the number > of products for sale. > i.e. The products.db will change from. > price no of items > $XXX 10 > > to > > price no of items > $XXX 8 > if the customer buys 2 items. > Is this aclompished in the final invoice.tmpl page. > Thanks in advance.Put this before the [purchase] tag:[ORDERFILE cart=[cart]] [LINEITEMS] [REPLACE db=Your.db&eqSKUdatarq=[SKU]]no_of_items=[MATH][LOOKUP db=your.db&value=[sku]&lookinfield=sku&returnfield=no_of_items]-[QTY][/MATH][/RE PLACE] [/LINEITEMS] [/ORDERFILE]This will subtract the quantity purchased from the database, but it *won't* prevent overselling a product. If PersonA puts 10 of something in their cart, and PersonB puts 5 of that same item in their cart before PersonA concludes his purchase, your no_of_items field will equal -5 when PersonB makes his purchase.If you want to prevent overselling an item, you're opening upo a whole new can of worms. It's pretty complicated, but I will post an example if that's what you're after.MichaelMichael Winston *By e-mail!: michaelw@dhorse.com Internet Coordinator *By web!: http://www.dhorse.com/ Dark Horse Comics, Inc. *By fax!: 503/654/9440 Associated Messages, from the most recent to the oldest:

    
  1. Re: Replacing entry (Jona Kamsteeg 1998)
  2. Re: Replacing entry (Mícheál O Sé 1998)
  3. Re: Replacing entry (Michael Winston 1998)
  4. Re: Replacing entry (Kenneth Grome 1998)
  5. Replacing entry (Mícheál O Sé 1998)
At 8:58 AM -0800 5/28/98, Mícheál O Sé is rumored to have typed: > Hi folks, > What is the best way to subtract from a product.db? > I want webcat to subtract the number of products purchased from the number > of products for sale. > i.e. The products.db will change from. > price no of items > $XXX 10 > > to > > price no of items > $XXX 8 > if the customer buys 2 items. > Is this aclompished in the final invoice.tmpl page. > Thanks in advance.Put this before the [purchase] tag:[ORDERFILE cart=[cart]] [lineitems] [REPLACE db=Your.db&eqSKUdatarq=[SKU]]no_of_items=[math][LOOKUP db=your.db&value=[sku]&lookinfield=sku&returnfield=no_of_items]-[QTY][/MATH][/RE PLACE] [/LINEITEMS] [/ORDERFILE]This will subtract the quantity purchased from the database, but it *won't* prevent overselling a product. If PersonA puts 10 of something in their cart, and PersonB puts 5 of that same item in their cart before PersonA concludes his purchase, your no_of_items field will equal -5 when PersonB makes his purchase.If you want to prevent overselling an item, you're opening upo a whole new can of worms. It's pretty complicated, but I will post an example if that's what you're after.MichaelMichael Winston *By e-mail!: michaelw@dhorse.com Internet Coordinator *By web!: http://www.dhorse.com/ Dark Horse Comics, Inc. *By fax!: 503/654/9440 Michael Winston

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:

WebDNA tags in WebMerchant email templates ... (1997) switching users (1998) Cyberstudio and WebDNA (1997) A helpful tip to avoid pulling an Aaron OT (2000) append=T problem (1998) [isfile] ? (1997) WebCatalog (1998) can WC render sites out? (1997) Bug report 06/30/2000 -- the no space in field name bug ... (2000) RE: Answer: WebDelivery downloads alias, not original ? (1997) [defined]ish (1997) hierarchy question... (2000) WebCatalog 4.0.1 has been released! (2000) [WebDNA] [ot-security] Heartbleed bug (2014) Porting to NT (2001) More help for discount pricing (1998) Quick Question (1997) %@#*& back button!!! (1999) Can't use old cart file (was One more try) (1997) DON'T use old cart file! (1997)