Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do i set highest value only

Status
Not open for further replies.

phreakgrrrl

Technical User
Jan 30, 2003
26
US
hey there...
i'd like to state a sorry in advance for being an annoying newbie but i really need some help here...

so i posted before but this problem seems to be getting more and more jumbled...

ok....i have a shopping cart...people need to be able to order more than one item and the shipping cost needs to be ONLY the highest shipping value listed...

heres what ive come up with .... with a little help ;>

<%
subtotal = 0
tempunitprice = CDbl(rsAddItem(&quot;unitprice&quot;))
subtotal = rsAddItem(&quot;quantity&quot;) * tempunitprice
subshipping = rsAddItem(&quot;shippingprice&quot;)
if rsAddItem(&quot;shippingprice&quot;)>1 then
totalshipping = rsAddItem(&quot;shippingprice&quot;)
end if
total = total + subtotal
%>

now as is...this gives me the shipping last shipping price listed ( unless its $0..which can tide my boss over for now)...but i kind of got thrown in here and am really not familiar with this stuff so any advise as to how to get my head out of my ass on this one would help...someone on this list suggested looping it but unfortunately...i know not how to do that and with large beginners book next to me..i just cant seem to figure it out..

in other words....HELP!

thanks
 
You have

if rsAddItem(&quot;shippingprice&quot;) > 1 then
totalshipping = rsAddItem(&quot;shippingprice&quot;)
endif

change that to

if rsAddItem(&quot;shippingprice&quot;) > totalshipping then
totalshipping = rsAddItem(&quot;shippingprice&quot;)
endif

and somewhere before you start, set totalshipping = 0...

-Rob
 
hey!
thanks for responding so quickly

i did what you suggested but that brought me back to my original problem..which was that it now takes the shipping price of the last item entered..highest value or not..
i tried setting the totalshipping = maximum value of rsAddItem(&quot;shippingprice&quot;)but i think im messing up the simple syntax..or maybe the logic isnt hitting me right..
is there a way to have it take the max value?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top