Re: Calculating a total

This WebDNA talk-list message is from

2000


It keeps the original formatting.
numero = 36191
interpreted = N
texte = 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 helpsJohn 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/ 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)
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 helpsJohn 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/ 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:

WebCat2_Mac RETURNs in .db (1997) Running _every_ page through WebCat ? (1997) purchase plugin (1996) NT lockup (1998) categories and subcategories (2004) Online Docs for the Beta... (2000) WebCat and search engines (1998) Poll Please (2002) passwords (2000) Beta 18 (1997) PR: WebCatalog Affiliates Program Announced -- Share the (2000) errors 550, and 108 (1998) Whois (2003) Searching multiple fields from one form field (1997) Flushdatabases - WCAT4 not functioning (2000) Emails are Stuck (2003) [WebDNA] Archives (2009) SUMM=T does not summarize by the sort parameters ... (2003) Add more fields to an existent data base (1997) Price and Formula.db (2002)