Re: Adding insurance to an order, round 2
This WebDNA talk-list message is from 2003
It keeps the original formatting.
numero = 50622
interpreted = N
texte = > This is not correct. Shipping is calculated everytime an orderfile> is enacted (from the formulas.db unless overridden by a setheader).Call me crazy, but that ain't what I'm seeing.Here is the code:On the template:[setheader cart=[GetCookie SessionID]&db=catalog.db]header40=[insurance][/setheader]([insurance] is passed in as T or F from a preceding page)In Formulas.db: What this code does is: checks to see if shipping is priority mail, then checks to see if the order total is > or < $45. If it's above $45, the shipping is free. Finally, it checks whether insurance has been added, by looking at header 40, which has been set to T if the customer has selected the insurance option. If insurance has been selected, it calculates the amount the insurance should be based on the order subtotal. The part of the formula at the end (between the [hideifs], calculates shipping (but not insurance) costs for our other shipping options, FedEx ground and FedEx Express.shipCost [showif [shipvia]=priority][format .2f][math]([showif [subtotal]<45][lookup db=ShipCosts.db&value=[shipvia]&lookinfield=ShipMethod&returnfield=ShipC ost][/showif][hideif [subtotal]<45]0.00[/hideif])[showif [header40]=T]+([showif [subtotal]<50.01][lookup db=dbs/ uspsinsurance.db&value=50&lookinfield=ordersubtotal&returnfield=insuranc e][/showif][showif [subtotal]>50][showif [subtotal]<100.01][lookup db=dbs/ uspsinsurance.db&value=100&lookinfield=ordersubtotal&returnfield=insuran ce][/showif][loop start=100&end=5000&advance=100][showif [subtotal]>[index].01][lookup db=dbs/ uspsinsurance.db&value=[index]&lookinfield=ordersubtotal&returnfield=ins urance][/showif][/loop][/showif])[/showif][/math][/format][/ showif][hideif [shipvia]=priority][lookup db=ShipCosts.db&value=[shipvia]&lookinfield=shipmethod&returnfield=shipc ost][/hideif]Symptoms:If priority mail is selected, and insurance is added, everything works.But, if the customer goes back and unselects insurance, and returns to the shopping cart page, the insurance is still there.Try it here:http://www.novaderm.com/shipcosttest.tpl (enter 4111111111111111 for the credit card #)Thanks,--Will StarckNovaDerm Skincare Sciencehttp://www.novaderm.comwjs@novaderm.com-------------------------------------------------------------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://webdna.smithmicro.com/
Associated Messages, from the most recent to the oldest:
> This is not correct. Shipping is calculated everytime an orderfile> is enacted (from the formulas.db unless overridden by a setheader).Call me crazy, but that ain't what I'm seeing.Here is the code:On the template:[setheader cart=[GetCookie SessionID]&db=catalog.db]header40=[insurance][/setheader]([insurance] is passed in as T or F from a preceding page)In formulas.db: What this code does is: checks to see if shipping is priority mail, then checks to see if the order total is > or < $45. If it's above $45, the shipping is free. Finally, it checks whether insurance has been added, by looking at header 40, which has been set to T if the customer has selected the insurance option. If insurance has been selected, it calculates the amount the insurance should be based on the order subtotal. The part of the formula at the end (between the [hideifs], calculates shipping (but not insurance) costs for our other shipping options, FedEx ground and FedEx Express.shipCost [showif [shipvia]=priority][format .2f][math]([showif [subtotal]<45][lookup db=ShipCosts.db&value=[shipvia]&lookinfield=ShipMethod&returnfield=ShipC ost][/showif][hideif [subtotal]<45]0.00[/hideif])[showif [header40]=T]+([showif [subtotal]<50.01][lookup db=dbs/ uspsinsurance.db&value=50&lookinfield=ordersubtotal&returnfield=insuranc e][/showif][showif [subtotal]>50][showif [subtotal]<100.01][lookup db=dbs/ uspsinsurance.db&value=100&lookinfield=ordersubtotal&returnfield=insuran ce][/showif][loop start=100&end=5000&advance=100][showif [subtotal]>[index].01][lookup db=dbs/ uspsinsurance.db&value=[index]&lookinfield=ordersubtotal&returnfield=ins urance][/showif][/loop][/showif])[/showif][/math][/format][/ showif][hideif [shipvia]=priority][lookup db=ShipCosts.db&value=[shipvia]&lookinfield=shipmethod&returnfield=shipc ost][/hideif]Symptoms:If priority mail is selected, and insurance is added, everything works.But, if the customer goes back and unselects insurance, and returns to the shopping cart page, the insurance is still there.Try it here:http://www.novaderm.com/shipcosttest.tpl (enter 4111111111111111 for the credit card #)Thanks,--Will StarckNovaDerm Skincare Sciencehttp://www.novaderm.comwjs@novaderm.com-------------------------------------------------------------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://webdna.smithmicro.com/
WJ Starck
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:
Quit revisited (1997)
Writing multiple data into one field (1998)
WebStar Secure on other machine (1997)
Append File help needed (2000)
carriage returns in data (1997)
ADD a product without Database (1998)
Encrypting the seed (2001)
WebDNA Engine Won't Start (2003)
WebCat 4.0 & WebMerchant (2000)
Sum of Quantities (1997)
A little help on e-mail (HELP!!! :-) ) (1998)
Intermitent problem using [referrer] (1997)
Symantec VIsual Page 1.0.3 (1997)
REPOST [SUM field=xxxx] (2000)
Version 2.0 and 1.6 simultaneous (1997)
WC2b15 File Corruption (1997)
shownext problems (1998)
read and write you own cookies with webcat (1997)
Explorer 3.0/ Access Denied! (1997)
Store Builder Expansion (2000)