More Discount Pricing thoughts/efforts

This WebDNA talk-list message is from

1998


It keeps the original formatting.
numero = 19100
interpreted = N
texte = Hi all,Here's another effort I've made at my discount pricing problem.THE DATABASE ============ SKU SHDESC PRLVL01 PRLVL02 PRLVL03 QTYLVL01 QTYLVL02 QTYLVL03 BN-5418 Blue Bag 20 19 18 11 23 49 BP-5915 Black Bag 19 18 17.5 11 23 49 BN-1218 Red Bag 14 13.5 13 11 23 49PRLVL01, PRLVL02, PRLVL03 are the prices at each discount level. QTYLVL01, QTYLVL01, QTYLVL01 are the quantity levels at which the corresponding prices are triggered. i. e. for SKU=BN-5418 from 1 to 11 (QTYLVL01) the price is $20.00(PRLVL01), after quantity 23 the price is $19.00. What I need to do is test for the quantity entered in the shopping cart and set/lookup the price appropriately for the quantity * price calculation on the trial invoice page.NEW STRATEGY ============ I decide to pass the PRLVLs and QTYLVLs for each product in the shopping cart [lineItems] context through to the Invoice.tpl template by using hidden input tags within the [lineItems] context itself, like so:[lineItems] [SKU] [SHDESC] $[PRLVL01] Remove Item [lineIndex] [/lineItems]My thinking is that in this way I don't have to do any lookups. The values I need for calculations are available with each shopping cart as it is created.THE RESULT ============ Using the [formVariables] context I can see that the following values are passed to the Invoice.tpl page when I add SKU BN-1218command,showcart CartIPAddress,206.126.145.249 cart,298429706887 db,catalog.txt quantity1,12 QTYLVL011,11 QTYLVL021,23 QTYLVL031,49 QTYLVL041,99999999 PRLVL011,14 PRLVL021,13.5 PRLVL031,13 PRLVL041,12 template,/WebCatalog/GeneralStore/Invoice.tplSELECTING 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.$[showif [math][quantity[lineIndex]][/math]<[QTYLVL014]][math][PRLVL011][/math][/sho wif]All I'm really trying to do at this point is see if I can put different quantities in the quantity input field on the shopping cart and get it to show the value for PRLVL011 (equal to 14 as passed through by the hidden input from the shopping cart) if the quantity is < than QTYLVL011 (equal to 11 as passed through by the hidden input from the shopping cart) or not show the value for PRLVL011 at all if it is greater than QTYLVL011.I've tried leaving the [math] contexts off, tried putting them around every value, and tried what I have included here. What I have included here yields the value of PRLVL011 i.e. 14 no matter what I put in the quantity input field on the ShoppingCart.tpl template.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 - like so:[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 would test for the quantity fitting within the range of one QTYLVL to the next and the assign the appropriate PRLVL for that range. It's the CONDITIONAL test that I can't seem to figure out. (Although I'll probably have problems with the [price] calculation the way things seem to be going now ;>) )I'm obviously not getting something. Any help would be appreciated. Is this a reasonable way to tackle this problem? Jerry Nielsen 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)
Hi all,Here's another effort I've made at my discount pricing problem.THE DATABASE ============ SKU SHDESC PRLVL01 PRLVL02 PRLVL03 QTYLVL01 QTYLVL02 QTYLVL03 BN-5418 Blue Bag 20 19 18 11 23 49 BP-5915 Black Bag 19 18 17.5 11 23 49 BN-1218 Red Bag 14 13.5 13 11 23 49PRLVL01, PRLVL02, PRLVL03 are the prices at each discount level. QTYLVL01, QTYLVL01, QTYLVL01 are the quantity levels at which the corresponding prices are triggered. i. e. for SKU=BN-5418 from 1 to 11 (QTYLVL01) the price is $20.00(PRLVL01), after quantity 23 the price is $19.00. What I need to do is test for the quantity entered in the shopping cart and set/lookup the price appropriately for the quantity * price calculation on the trial invoice page.NEW STRATEGY ============ I decide to pass the PRLVLs and QTYLVLs for each product in the shopping cart [lineitems] context through to the Invoice.tpl template by using hidden input tags within the [lineitems] context itself, like so:[lineitems] [SKU] [SHDESC] $[PRLVL01] [cart] >Remove Item [lineIndex] [/lineItems]My thinking is that in this way I don't have to do any lookups. The values I need for calculations are available with each shopping cart as it is created.THE RESULT ============ Using the [formvariables] context I can see that the following values are passed to the Invoice.tpl page when I add SKU BN-1218command,showcart CartIPAddress,206.126.145.249 cart,298429706887 db,catalog.txt quantity1,12 QTYLVL011,11 QTYLVL021,23 QTYLVL031,49 QTYLVL041,99999999 PRLVL011,14 PRLVL021,13.5 PRLVL031,13 PRLVL041,12 template,/WebCatalog/GeneralStore/Invoice.tplSELECTING 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.$[showif [math][quantity[lineIndex]][/math]<[QTYLVL014]][math][PRLVL011][/math][/sho wif]All I'm really trying to do at this point is see if I can put different quantities in the quantity input field on the shopping cart and get it to show the value for PRLVL011 (equal to 14 as passed through by the hidden input from the shopping cart) if the quantity is < than QTYLVL011 (equal to 11 as passed through by the hidden input from the shopping cart) or not show the value for PRLVL011 at all if it is greater than QTYLVL011.I've tried leaving the [math] contexts off, tried putting them around every value, and tried what I have included here. What I have included here yields the value of PRLVL011 i.e. 14 no matter what I put in the quantity input field on the ShoppingCart.tpl template.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 - like so:[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 would test for the quantity fitting within the range of one QTYLVL to the next and the assign the appropriate PRLVL for that range. It's the CONDITIONAL test that I can't seem to figure out. (Although I'll probably have problems with the [price] calculation the way things seem to be going now ;>) )I'm obviously not getting something. Any help would be appreciated. Is this a reasonable way to tackle this problem? Jerry Nielsen Jerry Nielsen

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:

[SMSI] WebDNA is too good to go away! (2006) NT or Mac (1998) WC2.0 Memory Requirements (1997) Help! WebCat2 bug (1997) Interfacing WebMerchant to www.fedex.com (1997) RE: groups and [ShowNext] (1997) Size limit for tmpl editor ? (1997) 4.5 -> 6.0 Upgrade (2005) [WebDNA] Dreamweaver Tag Libraries and Snippets (2011) [index] (1997) encrypt (2000) Feature Request: [moverecord] (2003) Help name our technology! I found it (1997) Emailer (1997) Bug Report, maybe (1997) [WebDNA] Not even sure what to ask for help on. . . :( (2008) SSL, WebSTAR, WebCatalog (1998) Search for 20 finds ... Eureka! (1997) database freeze (1997) WebCat2 beta 11 - new prefs ... (1997)