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:
advise!! (2001)
notification solutions (1997)
BinaryBody problem FIXED (2003)
Header info in content (1998)
Webdna 5.0 reference documentation (2003)
Add a Blog to your site. (2002)
[WebDNA] Clean URLS job - will pay (2010)
default value from Lookup (was Grant, please help me) (1997)
Sort Order on a page search (1997)
WebCatalog on Windows 98 (2000)
What ports does Webcatalog use (2003)
Looking for a Manual (1997)
Re[2]: Decrypting a user password (2000)
WCS Newbie question (1997)
I've been thinking (2002)
New Mac Public Beta Available (1997)
[WebDNA] png support in webDNA (2011)
Wrapping text (1998)
WebCat2: Items xx to xx shown, etc. (1997)
no global [username] or [password] displayed ... (1997)