Re: Tabled Discount

This WebDNA talk-list message is from

2003


It keeps the original formatting.
numero = 51421
interpreted = N
texte = I do this with a tabled lookup for each product in the product.db. You have 5 (to whatever) fields that are: qtyone,qtytwo,qtythree etc. and 5 fields that are discone,disctwo,discthree etc.. These fields are the price break fields and the respective discount. Then do something like below for a setlineitem (or if you need this when product is added you'll want to make use of the formulas.db.) [if [url][lookup db=admin/products.db&value=[theSKU]&lookInField=SKU&returnField=QTYONE][/url]!][then][!] [/!][text]qone=[url][lookup db=admin/products.db&value=[theSKU]&lookInField=SKU&returnField=QTYONE][/url][/text][!] [/!][if ([newqty]<[qone]) | ([newqty]=[qone])][!] [/!][then][text]newprice=[math][url][lookup db=admin/products.db&value=[theSKU]&lookInField=SKU&returnField=PRICE][/url]-[url][lookup db=admin/products.db&value=[theSKU]&lookInField=SKU&returnField=DISCONE][/url][/math][/text][/then][!] [/!][else][!] [/!][text]qtwo=[url][lookup db=admin/products.db&value=[theSKU]&lookInField=SKU&returnField=QTYTWO][/url][/text][!] [/!][if ([newqty]<[qtwo]) | ([newqty]=[qtwo])][!] [/!][then][text]newprice=[math][url][lookup db=admin/products.db&value=[theSKU]&lookInField=SKU&returnField=PRICE][/url]-[url][lookup db=admin/products.db&value=[theSKU]&lookInField=SKU&returnField=DISCTWO][/url][/math][/text][/then][!] [/!][else][!] [/!][text]qthree=[url][lookup db=admin/products.db&value=[theSKU]&lookInField=SKU&returnField=QTYTHREE][/url][/text][!] [/!][if ([newqty]<[qthree]) | ([newqty]=[qthree])][!] [/!][then][text]newprice=[math][url][lookup db=admin/products.db&value=[theSKU]&lookInField=SKU&returnField=PRICE][/url]-[url][lookup db=admin/products.db&value=[theSKU]&lookInField=SKU&returnField=DISCTHREE][/url][/math][/text][/then][!] [/!][else][!] ETC, ETC,... (newqty is the quantity comming into the code and theSKU of course is the SKU comming in. The loop context might make for more efficient code in this case. At any rate, This stuff can get a bit confusing as you will have to recheck all this stuff everytime the cart is edited. If you find that you would like some help, please contact me off list as I am currently looking for work. ;-) thanks, Donovan stephen wrote: >Anybody know what the best way of doing the following: > >If I have an item whose price is $4.00 each if user buys 1-4 and $3.00 each if user buys 5-10 and $2.75 each if they buy case of 12. > >Any thoughts? > > -- =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o DONOVAN D. BROOKE Developer / Consultant <-HTML,Javascript,WebDNA,CSS,Pre-Press Graphics,-> ADDRESS:> Donovan Brooke DBA Eucalyptus Design P.O. Box 260153 Madison, WI 53726-0153 PH:> 1.608.442.5217 email:> dbrooke@euca.us Web:> http://www.euca.us =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o ------------------------------------------------------------- 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 Web Archive of this list is at: http://webdna.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
  1. Re: Tabled Discount ( John Peacock 2003)
  2. Re: Tabled Discount ( Donovan 2003)
I do this with a tabled lookup for each product in the product.db. You have 5 (to whatever) fields that are: qtyone,qtytwo,qtythree etc. and 5 fields that are discone,disctwo,discthree etc.. These fields are the price break fields and the respective discount. Then do something like below for a setlineitem (or if you need this when product is added you'll want to make use of the formulas.db.) [if [url][lookup db=admin/products.db&value=[theSKU]&lookInField=SKU&returnField=QTYONE][/url]!][then][!] [/!][text]qone=[url][lookup db=admin/products.db&value=[theSKU]&lookInField=SKU&returnField=QTYONE][/url][/text][!] [/!][if ([newqty]<[qone]) | ([newqty]=[qone])][!] [/!][then][text]newprice=[math][url][lookup db=admin/products.db&value=[theSKU]&lookInField=SKU&returnField=PRICE][/url]-[url][lookup db=admin/products.db&value=[theSKU]&lookInField=SKU&returnField=DISCONE][/url][/math][/text][/then][!] [/!][else][!] [/!][text]qtwo=[url][lookup db=admin/products.db&value=[theSKU]&lookInField=SKU&returnField=QTYTWO][/url][/text][!] [/!][if ([newqty]<[qtwo]) | ([newqty]=[qtwo])][!] [/!][then][text]newprice=[math][url][lookup db=admin/products.db&value=[theSKU]&lookInField=SKU&returnField=PRICE][/url]-[url][lookup db=admin/products.db&value=[theSKU]&lookInField=SKU&returnField=DISCTWO][/url][/math][/text][/then][!] [/!][else][!] [/!][text]qthree=[url][lookup db=admin/products.db&value=[theSKU]&lookInField=SKU&returnField=QTYTHREE][/url][/text][!] [/!][if ([newqty]<[qthree]) | ([newqty]=[qthree])][!] [/!][then][text]newprice=[math][url][lookup db=admin/products.db&value=[theSKU]&lookInField=SKU&returnField=PRICE][/url]-[url][lookup db=admin/products.db&value=[theSKU]&lookInField=SKU&returnField=DISCTHREE][/url][/math][/text][/then][!] [/!][else][!] ETC, ETC,... (newqty is the quantity comming into the code and theSKU of course is the SKU comming in. The loop context might make for more efficient code in this case. At any rate, This stuff can get a bit confusing as you will have to recheck all this stuff everytime the cart is edited. If you find that you would like some help, please contact me off list as I am currently looking for work. ;-) thanks, Donovan stephen wrote: >Anybody know what the best way of doing the following: > >If I have an item whose price is $4.00 each if user buys 1-4 and $3.00 each if user buys 5-10 and $2.75 each if they buy case of 12. > >Any thoughts? > > -- =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o DONOVAN D. BROOKE Developer / Consultant <-HTML,Javascript,WebDNA,CSS,Pre-Press Graphics,-> ADDRESS:> Donovan Brooke DBA Eucalyptus Design P.O. Box 260153 Madison, WI 53726-0153 PH:> 1.608.442.5217 email:> dbrooke@euca.us Web:> http://www.euca.us =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o ------------------------------------------------------------- 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 Web Archive of this list is at: http://webdna.smithmicro.com/ Donovan

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:

WebCat control of Print (2001) IIS4/IIS3 and WebCatalog registry settings (1998) different show next (1997) Passing radio check box value to itself... (2000) HELP WITH DATES (1997) Catalog page question (1999) Expected Behavior? (1999) [sendmail] on NT? (1997) Cart doesn't interpret tag! (1997) Strange time in emails (2003) Follow-up to listfiles bug report ... (2003) Generating a random image, but avoiding repeated images. (1999) [shell] oddity (2002) WebCat2: multiple currency support (1997) Modifying order output (1997) Webstar V and Webcatalog (2001) Looking For WebCatalog Migration Assistance (2003) WebCat2b13MacPlugin - nested [xxx] contexts (1997) ShowIf & HideIf Question? (1998) rotating thumbnails (1997)