Re: More Discount Pricing thoughts/efforts

This WebDNA talk-list message is from

1998


It keeps the original formatting.
numero = 19104
interpreted = N
texte = At 14:08 Uhr +0000 26.07.1998, Jerry Nielsen wrote: >SELECTING PRICE BASED ON QUANTITY? (This is where I'm stuck, I think?) >================================== >My table in the Invoice.tpl template contains the following WebDNA in the >price cell. > >GOING FURTHER >============= >My final thought on this is that I would use Peter Ostry's code to make >the final [price] calculation for each item... >... >I would test for the quantity fitting within the range of one QTYLVL to >the next and the assign the appropriate PRLVL for that range... > >I'm obviously not getting something. Any help would be appreciated. Is >this a reasonable way to tackle this problem? Jerry,You have overseen a basic behavior of the [price] field: This field has to be named [price] and not somehow else. I know, that does not come out clearly from the manual, which unfortunately seldom tells when a fieldname is supposed to have a distinct name and when not. In other words: If there is a field called [price] in the database, it goes to the cart. If there is no such field, no price goes to the cart. You could use formulas.db to transfer something like PRLVL01 into [price]: Not good, you have rather complicated discount-calculations.You could make a quantity-db for each discount range to have a PRICE field in each one: Not good either - you reserved 2 digits for the quantity level, so I believe you will have a lot of them... But the following might be the right method: Do not deal directly with the cart, but rather use a temporary db with just two fields: sku and price - let us call it tempcart.db and it is always empty, until a user submits an item: [search...] your original database for sku, within [founditems] find out the quantity level [Append...] sku and calculated price to tempcart.db [AddLineItem ...] this new record to the cart! the price goes in automatically (because of the name) the quantity you know already and the description you put in a textfield finally [Delete ...] the record from tempcart. Thats it.Code for quantity calculation is now much easier to write, because you get the values from your database and you do not deal directly with the cart. And you are not forced to hardcode all your quantity levels. You can even handle a list of items which are submitted at once.I think this will fit for you, doesn't it?Ok, to avoid long explanations and heavy posting of code snippets, I built a rough example: http://demo.ostry.com/jerry If you like some parts of it you can have the templates. 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: More Discount Pricing thoughts/efforts (Peter Ostry 1998)
  2. More Discount Pricing thoughts/efforts (Jerry Nielsen 1998)
At 14:08 Uhr +0000 26.07.1998, Jerry Nielsen wrote: >SELECTING PRICE BASED ON QUANTITY? (This is where I'm stuck, I think?) >================================== >My table in the Invoice.tpl template contains the following WebDNA in the >price cell. > >GOING FURTHER >============= >My final thought on this is that I would use Peter Ostry's code to make >the final [price] calculation for each item... >... >I would test for the quantity fitting within the range of one QTYLVL to >the next and the assign the appropriate PRLVL for that range... > >I'm obviously not getting something. Any help would be appreciated. Is >this a reasonable way to tackle this problem? Jerry,You have overseen a basic behavior of the [price] field: This field has to be named [price] and not somehow else. I know, that does not come out clearly from the manual, which unfortunately seldom tells when a fieldname is supposed to have a distinct name and when not. In other words: If there is a field called [price] in the database, it goes to the cart. If there is no such field, no price goes to the cart. You could use formulas.db to transfer something like PRLVL01 into [price]: Not good, you have rather complicated discount-calculations.You could make a quantity-db for each discount range to have a PRICE field in each one: Not good either - you reserved 2 digits for the quantity level, so I believe you will have a lot of them... But the following might be the right method: Do not deal directly with the cart, but rather use a temporary db with just two fields: sku and price - let us call it tempcart.db and it is always empty, until a user submits an item: [search...] your original database for sku, within [founditems] find out the quantity level [Append...] sku and calculated price to tempcart.db [AddLineItem ...] this new record to the cart! the price goes in automatically (because of the name) the quantity you know already and the description you put in a textfield finally [Delete ...] the record from tempcart. Thats it.Code for quantity calculation is now much easier to write, because you get the values from your database and you do not deal directly with the cart. And you are not forced to hardcode all your quantity levels. You can even handle a list of items which are submitted at once.I think this will fit for you, doesn't it?Ok, to avoid long explanations and heavy posting of code snippets, I built a rough example: http://demo.ostry.com/jerry If you like some parts of it you can have the templates. 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:

payment processors (2005) suffix mapping, use of cache, etc. (1997) forming a SKU (1999) PIXO (1997) WebDNA 5.1/Apache 2 (2003) stumped on simple sort (1999) Issue with plug-in Webcat, webstar 4.x, SSL and IE when using the backbuttom (2000) RE: AccountAuthorizer doesn't seem to work (1997) WebCat2b13MacPlugIn - [include] doesn't allow creator (1997) ShowNext Command (1997) RE: error count with $purchase (1997) Username for Admin Group (1997) Help! WebCat2 bug (1997) WebCat2b12 CGI Mac - [shownext] problem (1997) Help formatting search results w/ table (1997) can WC render sites out? (1997) eMailer replacement? (1998) French characters in variables (2001) range searching (1998) ReturnRaw (1999)