Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Calculate an amount from 2 fields

Quote Reply
Calculate an amount from 2 fields
I'm trying to make a calculations from 2 fields in the same table.
I have a field named "MSRP" for the Retail Price of the item, and a field named "Price" for my sales price.

I want to subtract the "Price" from the "MSRP" in my template and display the difference as "You Save" to my site customers. I would also like to display the percentage that is saved.

See an example of what I mean at: http://www.overstock.com

Any help would be greatly appreciated!

Thanks,
Rick
Quote Reply
Re: [rcaudio] Calculate an amount from 2 fields In reply to
Hi Rick,

On the admin pages,there is a link to help pages in the upper right corner. Click on that link, then choose 'GT Module Documentation' and then 'Template'. This page explains how to calculate values.

Hope this helps, Jasper

http://www.bookings.org
Quote Reply
Re: [jaspercram] Calculate an amount from 2 fields In reply to
Thanks for your reply!
I looked over the help document that you mentioned before my initial post, but was unable to figure out a way to calculate a formula that works for my situation. I'm not really a programmer, so I don't really understand every detail, but I'm trying to learn as much as possible.

I tried template tags like these, but nothing works:
(Any ideas?)

<%MSRP - Price%>
<%MSRP -= Price%>
<%'MSRP' - 'Price'%>
<%('MSRP - Price')%>

<%MSRP - 10%> (this works, displays the MSRP minus the value of 10)

Thanks in advance!
Rick
Quote Reply
Re: [rcaudio] Calculate an amount from 2 fields In reply to
I didn't test it, but you could try something like
Code:
<%MSRP - $Price%>
Good luck, Jasper

http://www.bookings.org
Quote Reply
Re: [jaspercram] Calculate an amount from 2 fields In reply to
Thanks, that worked perfectly! Wink

Rick