Re: Calculating a total

This WebDNA talk-list message is from

2000


It keeps the original formatting.
numero = 36222
interpreted = N
texte = Thanks for that John, I will investigate the technique more :) -- Stuart TremainDigital Imaging Division The Ad-Libitum Group 48 Victoria Street North Sydney 2060 Australia Phone: +612 9959 5633 Fax: +612 9929 4146email: stuartt@adlib.com.au http://www.adlib.com.auOn Wednesday, 16 August 2000, John Peacock wrote: >I've read your other messages, but I thought I would respond to the >original post. I believe that you are over thinking this; it is >actually much easier than you think. > >WebCatalog is, at its heart, an e-commerce system. As such, it does >most of the things you want to do with an e-commerce system >automatically. One of these things is grandtotal; if each of your line >items has a price and a quantity, WebCat will automatically add every >line's price*quantity, add any shipping, add any tax, and return a >grandtotal. > >What I think you are missing is how the price gets assigned to each >line. If you look at the HTML docs under formulas, you will see that >you can edit a line in the formulas.db and create a formula (like the >one you already posted) that executes in an automatic math context, >with all of the variables associated with that line item, and returns >a single value which is then stored in the price field for that line >item. > >For example (using a simple formula) enter this into your >formulas.db: > >price[showif [Math][textA]<3[/math]]0.95*[/ShowIf][lookup >db=main.db&value=[SKU]&lookInField=SKU&returnField=price¬Found=0] > >where is a tab character, and all of the remaining text is on >one line. What this formula does is look at the value in the line >field [textA] (what you called [weeks]) and if it is less than 3, then >multiply the price in your main catalog database by 0.95. Your >formula will be more complicated than this of course. But the point >is the same. You assign the correct price to each line item, on a per >unit basis, and WebCatalog will sum up the items for you inside any >orderfile context. You can see what fields are available for you by >looking at the showcart and purchase commands in the manual. > >Hope this helps > >John Peacock > > >Stuart Tremain wrote: >> >> My shopping cart contains items whose prices have been >calculated according to how long the product's life is. >> >> My question is, how can I add these calculated prices to give a total? >> I thought of giving them a value but I'm not sure how to >gather the values together to calculate a total. >> >> All ideas appreciated >> -- >> Stuart Tremain >> >> Digital Imaging Division >> The Ad-Libitum Group >> 48 Victoria Street >> North Sydney 2060 Australia >> Phone: +612 9959 5633 Fax: +612 9929 4146 >> >> email: stuartt@adlib.com.au >> http://www.adlib.com.au > >------------------------------------------------------------- >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/ >------------------------------------------------------------- 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:

    
  1. Re: Calculating a total (Stuart Tremain 2000)
  2. Re: Calculating a total (Rob Marquardt 2000)
  3. Re: Calculating a total (John Peacock 2000)
  4. Re: Calculating a total (Stuart Tremain 2000)
  5. Re: Calculating a total (Stuart Tremain 2000)
  6. Calculating a total (Stuart Tremain 2000)
Thanks for that John, I will investigate the technique more :) -- Stuart TremainDigital Imaging Division The Ad-Libitum Group 48 Victoria Street North Sydney 2060 Australia Phone: +612 9959 5633 Fax: +612 9929 4146email: stuartt@adlib.com.au http://www.adlib.com.auOn Wednesday, 16 August 2000, John Peacock wrote: >I've read your other messages, but I thought I would respond to the >original post. I believe that you are over thinking this; it is >actually much easier than you think. > >WebCatalog is, at its heart, an e-commerce system. As such, it does >most of the things you want to do with an e-commerce system >automatically. One of these things is grandtotal; if each of your line >items has a price and a quantity, WebCat will automatically add every >line's price*quantity, add any shipping, add any tax, and return a >grandtotal. > >What I think you are missing is how the price gets assigned to each >line. If you look at the HTML docs under formulas, you will see that >you can edit a line in the formulas.db and create a formula (like the >one you already posted) that executes in an automatic math context, >with all of the variables associated with that line item, and returns >a single value which is then stored in the price field for that line >item. > >For example (using a simple formula) enter this into your >formulas.db: > >price[showif [math][textA]<3[/math]]0.95*[/ShowIf][lookup >db=main.db&value=[SKU]&lookInField=SKU&returnField=price¬Found=0] > >where is a tab character, and all of the remaining text is on >one line. What this formula does is look at the value in the line >field [textA] (what you called [weeks]) and if it is less than 3, then >multiply the price in your main catalog database by 0.95. Your >formula will be more complicated than this of course. But the point >is the same. You assign the correct price to each line item, on a per >unit basis, and WebCatalog will sum up the items for you inside any >orderfile context. You can see what fields are available for you by >looking at the showcart and purchase commands in the manual. > >Hope this helps > >John Peacock > > >Stuart Tremain wrote: >> >> My shopping cart contains items whose prices have been >calculated according to how long the product's life is. >> >> My question is, how can I add these calculated prices to give a total? >> I thought of giving them a value but I'm not sure how to >gather the values together to calculate a total. >> >> All ideas appreciated >> -- >> Stuart Tremain >> >> Digital Imaging Division >> The Ad-Libitum Group >> 48 Victoria Street >> North Sydney 2060 Australia >> Phone: +612 9959 5633 Fax: +612 9929 4146 >> >> email: stuartt@adlib.com.au >> http://www.adlib.com.au > >------------------------------------------------------------- >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/ >------------------------------------------------------------- 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/ Stuart Tremain

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:

[Sum] function? (1997) [isfile] ? (1997) [writefile] (1997) format_to_days on NT (1997) Can this be done? (1997) PIXO support (1997) Follow-Up to: Removing [showif] makes a big difference in speed (1997) Shownext from POST (2000) Formatted [time] inside sendmail (2002) [WebDNA] function variables (2011) F3 crashing server (1997) WebCat2: multiple currency support (1997) No incentive ... (2000) Signal Raised Error (Part II) (1997) help on brickwalls (2003) WC1.6 to WC2 date formatting (1997) Error Lob.db records error message not name (1997) Document Contains No Data (1998) Using Plug-In while running 1.6.1 (1997) Emailer setup (1997)