Re: Discount solution?
This WebDNA talk-list message is from 1998
It keeps the original formatting.
numero = 19072
interpreted = N
texte = At 10:30 Uhr 24.07.1998, Will Starck wrote:>I need help creating a template that will apply discounts based on the>number of items a person orders. If anyone who has a solution or a premade>template I could have a look-see at I'd really appreciate it.I assume you have discount groups, otherwise it would be simple math.example 1You can build a discount.db to store the appropriate values and make alookup in this db. For a rather small range it is easy, just write allpossible values in one column and all related discounts (percent?) in thesecond one:ITEMS DISCOUNT1 02 03 54 55 106 107 108 109 1010 1511 15..and so on..then run a [lookup...] for the items-field and return the related discountfield to do your calculation on the price.If you have too much values and many discount groups, you should try tobreak the given numbner of items down with some math action before thelookup, to get a short discount.dbexample 2If a discount is given for just a few steps, use showif's. You can writenested showif's, but I prefere the following technique - setting a variable[gotit] to 1 in any loop disables further calculations:[math show=f][gotit]=0[/math] (set gotit to 0)[showif [math][items][/math]>100] [math show=f][gotit]=1[/math] ..calculate 30% discount..[/showif][showif [math][gotit][/math]=0] (gotit still 0?) [showif [math][items][/math]>50] [math show=f][gotit]=1[/math] ..calculate 20% discount.. [/showif][/showif][showif [math][gotit][/math]=0] (gotit still 0?) [showif [math][items][/math]>10] [math show=f][gotit]=1[/math] ..calculate 10% discount.. [/showif][/showif][showif [math][gotit][/math]=0] (gotit still 0?) ..no discount..[/showif]I know, with WebCat there is no need to set the variable at the begin, I amjust used to...Peter__________________________________________Peter Ostry - po@ostry.com - www.ostry.comOstry & Partner - Ostry Internet SolutionsAuhofstrasse 29 A-1130 Vienna Austriafon ++43-1-8777454 fax ++43-1-8777454-21
Associated Messages, from the most recent to the oldest:
At 10:30 Uhr 24.07.1998, Will Starck wrote:>I need help creating a template that will apply discounts based on the>number of items a person orders. If anyone who has a solution or a premade>template I could have a look-see at I'd really appreciate it.I assume you have discount groups, otherwise it would be simple math.example 1You can build a discount.db to store the appropriate values and make alookup in this db. For a rather small range it is easy, just write allpossible values in one column and all related discounts (percent?) in thesecond one:ITEMS DISCOUNT1 02 03 54 55 106 107 108 109 1010 1511 15..and so on..then run a [lookup...] for the items-field and return the related discountfield to do your calculation on the price.If you have too much values and many discount groups, you should try tobreak the given numbner of items down with some math action before thelookup, to get a short discount.dbexample 2If a discount is given for just a few steps, use showif's. You can writenested showif's, but I prefere the following technique - setting a variable[gotit] to 1 in any loop disables further calculations:[math show=f][gotit]=0[/math] (set gotit to 0)[showif
[math][items][/math]>100] [math show=f][gotit]=1[/math] ..calculate 30% discount..[/showif][showif
[math][gotit][/math]=0] (gotit still 0?) [showif
[math][items][/math]>50] [math show=f][gotit]=1[/math] ..calculate 20% discount.. [/showif][/showif][showif
[math][gotit][/math]=0] (gotit still 0?) [showif
[math][items][/math]>10] [math show=f][gotit]=1[/math] ..calculate 10% discount.. [/showif][/showif][showif
[math][gotit][/math]=0] (gotit still 0?) ..no discount..[/showif]I know, with WebCat there is no need to set the variable at the begin, I amjust used to...Peter__________________________________________Peter Ostry - po@ostry.com - www.ostry.comOstry & Partner - Ostry Internet SolutionsAuhofstrasse 29 A-1130 Vienna Austriafon ++43-1-8777454 fax ++43-1-8777454-21
Peter Ostry
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] Test (2014)
Dealer Locator (zip codes) (2003)
can webcat create directories on NT? (1997)
maximum characters in [username]? (2002)
Width & Height (1998)
Changing the value assigned to a formvariable (2000)
Using WC for Bulk Emailings (1997)
combine search (1998)
Serial Num (2003)
WebDNA dying or ... ? (2005)
Problems with SELECT MULTIPLE (1999)
Trouble with Netscape (1998)
FAX orders (1996)
Number searching/formats (1998)
many-to-one problem (1998)
Opinion: [input] should be called [output] ... (1997)
Database Program (1997)
Dummy Credit Card Number for debug? (1997)
creator code (1997)
WebCat2b13MacPlugIn - more [date] problems (1997)