Forum Moderators: open

Message Too Old, No Replies

Help with a basic question

         

TSadmin

4:07 pm on Apr 5, 2006 (gmt 0)

10+ Year Member



Hello all,

I am using a ecommerce solution. They gave us some asp variables that are something to the effect
<% DRAWPRODUCTPRICE %>
<% DRAWPRODUCTSALE %>

They way that have it set up for us is we just add these to the body of a page where we want them and the values show up.

Is it possible and how would i be able to subtract these two variables and display the difference on the site? This way i could show the cusomter what they are saving.

Thank you all for your help
Al

celgins

8:16 pm on Apr 5, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



<%= DRAWPRODUCTPRICE - DRAWPRODUCTSALE %> should give you want you want.

TSadmin

3:04 pm on Apr 6, 2006 (gmt 0)

10+ Year Member



For some reason that is not working. Could thoese tags be calling a function and not a var.? Would it be possible to test a var. and show an image if the results were true or false/ Like if the price is over 100 show a free shipping image.

Thanks again for the help, I really appreciate it!
Al

celgins

3:36 pm on Apr 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



For some reason that is not working. Could thoese tags be calling a function and not a var.? Would it be possible to test a var. and show an image if the results were true or false/ Like if the price is over 100 show a free shipping image.

Very well could be two functions. If "DRAWPRODUCTPRICE" and "DRAWPRODUCTSALE" are both variables representing numeric expressions, the example I gave you will surely work. If they are functions, there are instances when they would work and other times when they wouldn't work. It really depends on what those two variables (or functions) are doing.

As far as testing a variable and showing different images based on true/false results, that can be done in a number of ways: (IF THEN ELSE statements, DO WHILE statements, or even a FOR NEXT statement)

TSadmin

3:58 pm on Apr 6, 2006 (gmt 0)

10+ Year Member



Do you have any good sites with examples of the syntax for that. I have not done anything with asp for a few years so I need a little warm up. When I plugged in the statement you gave me nothign showed up. So iam not really sure what my provider set up.

Thanks once again for your time
Alex

defanjos

10:09 pm on Apr 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



They are probably session variables.

Try this on the page:

<%
response.write "Session:" & "<br>"
response.write session("DRAWPRODUCTPRICE") & "<br>"
response.write session("DRAWPRODUCTSALE")
%>

Does anything get written to the page?
If so, they are session variables.

You cannot just use <%=DRAWPRODUCTSALE%> if that variable was not set somewhere on the page.

They could also be set at a previous page, so try:

<%
response.write "Request:" & "<br>"
response.write request("DRAWPRODUCTPRICE") & "<br>"
response.write request("DRAWPRODUCTSALE")
%>

If nothing happens, they are not session variables or variables sent from a previous page.