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:
WebCat and image maps (1997)
Banner Ad example (Typhoon) and WebCatalog (1997)
It just Does't add up!!! (1997)
Funny Math (2000)
transferring values (1998)
WebCommerce: Folder organization ? (1997)
Will webdna execute before a [redirect]? (1999)
Location of Browser Info.txt file (1997)
Include a big block of text (1997)
WebCat + IIS (2001)
[WebDNA] WebCatalog runaway process (2011)
Banner DNA (1997)
Resume Catalog ? (1997)
auto adding SKUs w/DB helper (1998)
Can you do this??? and other stuff (1997)
Postdata expired from cache (2004)
2.0 Info (1997)
AutoCommit Preference? (1998)
WebCat2 - [include] tags (1997)
Sensations (1997)