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 1 You can build a discount.db to store the appropriate values and make a lookup in this db. For a rather small range it is easy, just write all possible values in one column and all related discounts (percent?) in the second one: ITEMS DISCOUNT 1 0 2 0 3 5 4 5 5 10 6 10 7 10 8 10 9 10 10 15 11 15 ..and so on.. then run a [lookup...] for the items-field and return the related discount field to do your calculation on the price. If you have too much values and many discount groups, you should try to break the given numbner of items down with some math action before the lookup, to get a short discount.db example 2 If a discount is given for just a few steps, use showif's. You can write nested 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 am just used to... Peter__________________________________________ Peter Ostry - po@ostry.com - www.ostry.com Ostry & Partner - Ostry Internet Solutions Auhofstrasse 29 A-1130 Vienna Austria fon ++43-1-8777454 fax ++43-1-8777454-21 Associated Messages, from the most recent to the oldest:

    
  1. Re: Discount solution? (Peter Ostry 1998)
  2. Discount solution? (Will Starck 1998)
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 1 You can build a discount.db to store the appropriate values and make a lookup in this db. For a rather small range it is easy, just write all possible values in one column and all related discounts (percent?) in the second one: ITEMS DISCOUNT 1 0 2 0 3 5 4 5 5 10 6 10 7 10 8 10 9 10 10 15 11 15 ..and so on.. then run a [lookup...] for the items-field and return the related discount field to do your calculation on the price. If you have too much values and many discount groups, you should try to break the given numbner of items down with some math action before the lookup, to get a short discount.db example 2 If a discount is given for just a few steps, use showif's. You can write nested 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 am just used to... Peter__________________________________________ Peter Ostry - po@ostry.com - www.ostry.com Ostry & Partner - Ostry Internet Solutions Auhofstrasse 29 A-1130 Vienna Austria fon ++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)