Re: shipping & multiple comparisons?
This WebDNA talk-list message is from 2000
It keeps the original formatting.
numero = 32748
interpreted = N
texte = I guess the first question should be WHY? Are you a glutton for punish-ment or do you just like pain? ;~)Seriously though, the whole point (IMNSHO) of WebCatalog is the built-ine-commerce functionality. If you Read The Fine Manual, specifically thepages on Formulas and Order File (both on the File Formats tab), you will discover that the header field shipCost is a order-wide shipping cost (go figure).You can either create a formula entry or a form variable or if all elsefails use [setheader] to update the shipCost value, which will then correctly add to the subtotal as you expect.You also seem to have fallen for the common trap of using [text] ratherthan [math] for your variables. If you intend to perform math on avariable, you need to define it as a [math] variable. This is just ascommon as the person who uses [math] for things that need to be [text].So, to start with (inside a orderfile context): [math]ship=0[lineitems]+[quantity][/lineitems][/math]will get you the number of line items.Now use the following formula (formatted for readability only):[showif [ship]>5] [math][subtotal]*.15[/math][showif][hideif [ship]>5] [math]0+[showif [ship]<3] 4.5[/showif][!]good for 1,2[/!] [showif [ship]<6]+1.5[/showif][!]good for 3,4,5[/!] [/math][/hideif]This will be easier with 4.0 of course. In any case, this will returnthe shipCost at any given point. This can be either inserted directlyinto the formulas.db or assigned to a math variable called shipcost. You can also update the head manually (if you like pain ;~).I hope this helps to see that there is more than one way to do it, andbreaking the problem into little steps makes it easier.John Peacockp.s. IMNSHO = In My Not So Humble OpinionParker wrote:> > trying to get the following to work as replacement for> [grandtotal]. [ship] is [text]ship=[math]0[lineitems]+[quantity][/lineitems][/math][/text]> which works great:> > [showif [ship]<3][math][subtotal]+4.50[/math][/showif]> [showif [ship]^3,4,5][math][subtotal]+6.00][/math][/showif]> [showif [ship]>5][math][subtotal]*.15[/math][/showif]> > <3 and >5 works fine obviously, but I'm having trouble with> multiple comparisons ala the middle one... I also tried> splitting them up like:> > [showif [ship]=3][math][subtotal]+6.00][/math][/showif]> [showif [ship]=4][math][subtotal]+6.00][/math][/showif]> [showif [ship]=5][math][subtotal]+6.00][/math][/showif]> > but that just displays 0 for some reason... I'm close, but> what do I need to get that 3-5 to work at $6.00?? Thanks and> forgive if this is obvious.. I couldn't find what I need in> the list archives or docs yet on inclusive comparisons etc.-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list
.To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://search.smithmicro.com/
Associated Messages, from the most recent to the oldest:
I guess the first question should be WHY? Are you a glutton for punish-ment or do you just like pain? ;~)Seriously though, the whole point (IMNSHO) of WebCatalog is the built-ine-commerce functionality. If you Read The Fine Manual, specifically thepages on Formulas and order file (both on the File Formats tab), you will discover that the header field shipCost is a order-wide shipping cost (go figure).You can either create a formula entry or a form variable or if all elsefails use [setheader] to update the shipCost value, which will then correctly add to the subtotal as you expect.You also seem to have fallen for the common trap of using [text] ratherthan [math] for your variables. If you intend to perform math on avariable, you need to define it as a [math] variable. This is just ascommon as the person who uses [math] for things that need to be [text].So, to start with (inside a orderfile context): [math]ship=0[lineitems]+[quantity][/lineitems][/math]will get you the number of line items.Now use the following formula (formatted for readability only):[showif [ship]>5] [math][subtotal]*.15[/math][showif][hideif [ship]>5] [math]0+[showif [ship]<3] 4.5[/showif][!]good for 1,2[/!] [showif [ship]<6]+1.5[/showif][!]good for 3,4,5[/!] [/math][/hideif]This will be easier with 4.0 of course. In any case, this will returnthe shipCost at any given point. This can be either inserted directlyinto the formulas.db or assigned to a math variable called shipcost. You can also update the head manually (if you like pain ;~).I hope this helps to see that there is more than one way to do it, andbreaking the problem into little steps makes it easier.John Peacockp.s. IMNSHO = In My Not So Humble OpinionParker wrote:> > trying to get the following to work as replacement for> [grandtotal]. [ship] is [text]ship=[math]0[lineitems]+[quantity][/lineitems][/math][/text]> which works great:> > [showif [ship]<3][math][subtotal]+4.50[/math][/showif]> [showif [ship]^3,4,5][math][subtotal]+6.00][/math][/showif]> [showif [ship]>5][math][subtotal]*.15[/math][/showif]> > <3 and >5 works fine obviously, but I'm having trouble with> multiple comparisons ala the middle one... I also tried> splitting them up like:> > [showif [ship]=3][math][subtotal]+6.00][/math][/showif]> [showif [ship]=4][math][subtotal]+6.00][/math][/showif]> [showif [ship]=5][math][subtotal]+6.00][/math][/showif]> > but that just displays 0 for some reason... I'm close, but> what do I need to get that 3-5 to work at $6.00?? Thanks and> forgive if this is obvious.. I couldn't find what I need in> the list archives or docs yet on inclusive comparisons etc.-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://search.smithmicro.com/
John Peacock
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:
Shipping charges based on dollar level (1997)
Include a big block of text (1997)
[ShowCart] and GET vs. POST (1997)
WebCat2b15MacPlugin - [protect] (1997)
Bug? (1997)
append db wierdness (1999)
adding shipping cost (1998)
form data submission gets truncated (1997)
WebCat2b14MacPlugIn - [include] doesn't hide the search string (1997)
Bug Report, maybe (1997)
storebuilder problems on RedHat 6.1 with webcat 3.08 (2000)
Three new problems, maybe a fourth (1997)
two unique banners on one page (1997)
USPS Intergration (2001)
[WebDNA] How do we tell what's misconfigured? Or which WebDNA 7 version to use? (2011)
Web Catalog vs. ICAT (1997)
webcat memory problem (2001)
Emailer choke (1997)
Web Catalog not encrypting/decrypting problem (1998)
FEW QUESTIONS (1997)