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 Starck NovaDerm Skincare Science http://www.novaderm.com wjs@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:

    
  1. Re: Adding insurance to an order, round 2 (WJ Starck 2003)
  2. Re: Adding insurance to an order, round 2 (WJ Starck 2003)
  3. Re: Adding insurance to an order, round 2 (dbrooke 2003)
  4. Re: Adding insurance to an order, round 2 (Tim Robinson 2003)
  5. Re: Adding insurance to an order, round 2 (WJ Starck 2003)
  6. Re: Adding insurance to an order, round 2 (Tim Robinson 2003)
  7. Re: Adding insurance to an order, round 2 (WJ Starck 2003)
  8. Adding insurance to an order, round 2 (WJ Starck 2003)
> 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 Starck NovaDerm Skincare Science http://www.novaderm.com wjs@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:

OT: JavaScript question (2001) Web Catalog vs. ICAT (1997) Navigator 4.01 (1997) Re:listfiles-looking for slick solution (1997) Grant, please help me ... (1997) timing out? (1997) U&P IIS concept (1998) [OT] OSX (unix) favorite text editor. (2002) How can I Add several Items into the cart at once? (1997) SM: MySQL and Numbers (BUG) (2005) WebTV problems with WebCatalog?? (1998) [WebDNA] TCPConnect example doesn't work (2017) WebCat2.0 [format thousands .0f] no go (1997) WebCat & cookies (1998) calculating tax rates, mail order solutions and version 2 (1997) Multiple prices (1997) Inventory Adjustment SOLUTION (2000) Another question about credit cards (1997) Help name our technology! (1997) Re:quit command on NT (1997)