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 doesmost of the things you want to do with an e-commerce system automatically. One of these things is grandtotal; if each of your lineitems has a price and a quantity, WebCat will automatically add everyline's price*quantity, add any shipping, add any tax, and return agrandtotal.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 thatyou can edit a line in the formulas.db and create a formula (like theone you already posted) that executes in an automatic math context,with all of the variables associated with that line item, and returnsa single value which is then stored in the price field for that lineitem.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 onone line. What this formula does is look at the value in the linefield [textA] (what you called [weeks]) and if it is less than 3, thenmultiply the price in your main catalog database by 0.95. Yourformula will be more complicated than this of course. But the pointis the same. You assign the correct price to each line item, on a perunit basis, and WebCatalog will sum up the items for you inside anyorderfile context. You can see what fields are available for you bylooking at the showcart and purchase commands in the manual.Hope this helpsJohn PeacockStuart 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:
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 doesmost of the things you want to do with an e-commerce system automatically. One of these things is grandtotal; if each of your lineitems has a price and a quantity, WebCat will automatically add everyline's price*quantity, add any shipping, add any tax, and return agrandtotal.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 thatyou can edit a line in the formulas.db and create a formula (like theone you already posted) that executes in an automatic math context,with all of the variables associated with that line item, and returnsa single value which is then stored in the price field for that lineitem.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 onone line. What this formula does is look at the value in the linefield [textA] (what you called [weeks]) and if it is less than 3, thenmultiply the price in your main catalog database by 0.95. Yourformula will be more complicated than this of course. But the pointis the same. You assign the correct price to each line item, on a perunit basis, and WebCatalog will sum up the items for you inside anyorderfile context. You can see what fields are available for you bylooking at the showcart and purchase commands in the manual.Hope this helpsJohn PeacockStuart 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:
quantity minimum problem (1997)
Sorting Numbers (1997)
TCPConnect / Current Temperature (2004)
Purchased cart being overwritten - still !?? (1997)
[writefile] remotely (2000)
Appendfile memory usage (redux) (2003)
[WebDNA] Filtering exact numbers (2008)
No luck with taxes (1997)
WebCatalog.acgi quitting with error Type 2 (1998)
Special delete ... (1997)
WebCatalog 2.0.1 for Windows released! (1997)
[WebDNA] BBEdit WebDNA Configuration.plist (Language (2013)
WebCat2 beta FTP site (1997)
SSL, WebSTAR, WebCatalog (1998)
Date Formats (1997)
checkout.tpl (1999)
hierarchy question... (2000)
WebCatalog for Postcards ? (1997)
Virtual hosting and webcatNT (1997)
Search: Is this possible? (2005)