<% set conn = Server.Createobject("adodb.connection") set rs = server.createobject("adodb.recordset") set rs2 = server.createobject("adodb.recordset") set rs3 = server.createobject("adodb.recordset") hide=false dim boxes() dim boxcount dim subtotwt dim ordermmf function NoZero(a,b) if b = 0 then NoZero = a else NoZero = a & " - " & formatcurrency(b) end if end function function calcshippingUPS(z,totwt,table,field) 'response.write "seeking zip " & z & " for " & totwt & " pounds in table " & table & " field " & field & "
" 'table can be ' Rates1stDayAM ' Rates1stDaySaver ' Rates2ndDay ' Rates2ndDayAM ' Rates3rdDay ' RatesGround '1.40 will be added to change from commercial rates to residential 'field can be ' Ground ' 3 Day Select ' 2nd Day Air ' 2nd Day Air AM ' Next Day Air Saver ' Next Day Air shipping = 0 'default Set t_rs2 = Server.CreateObject("ADODB.Recordset") t_rs2.open "select * from zones" , conn found1=false do while not t_rs2.eof a=instr(t_rs2("Dest ZIP"),"-") if a > 0 then z1=left(t_rs2("Dest ZIP"),a-1) z2=mid(t_rs2("Dest ZIP"),a+1) else z1=t_rs2("Dest ZIP") z2=z1 end if 'response.write "z=" & left(z,len(z1)) & " --- z1, z2 = " & z1 & ", " &z2 & "
" If z1 &"" <=left(z,len(z1)) and left(z,len(z2))<=z2 &"" then 'response.write z1 & " <= " & left(z,len(z1)) & " --> " & (z1 &"" <= left(z,len(z1))) & "
" 'response.write left(z,len(z2)) & " <= "& z2 &" --> " & (left(z,len(z1))<= z2 & "") & "
" found1 = true exit do End If t_rs2.movenext loop 'response.write "found=" & found1 & "
" shipping =0 if found1 then 'response.write "found zip, zone = " & t_rs2(field) &"between " & z1 & " and " & z2 &"
" gr = t_rs2(field) t_rs2.close found2 = false t_rs2.open "select * from "&table&" where [weight not to exceed]>=" & totwt &" order by [weight not to exceed]",conn if not t_rs2.eof then if isnumeric(gr) then for each f in t_rs2.fields if ucase(f.name) = "Z" & trim(gr) then shipping = t_rs2("z" & trim(gr)) 'response.write "rate= " & t_rs2("z" &trim(gr)) & "
" found2=true exit for end if next end if end if if shipping <> 0 then 'If 0, leave it that way 'if shipping < 5.45 then 'This is the minimum shipping amount 'let then handle it manually 'shipping = 5.45 'handling 'shipping = 0 'else 'shipping = shipping + 1.75 ' + 1.75 residential for 2005 'response.write "final shipping returned = " & shipping & "
" 'end if end if end if t_rs2.close set t_rs=nothing set t_rs2=nothing if shipping > 0 then calcshippingUPS =shipping+1.3 ' surcharge else calcshippingups = 0 end if end function function RateUPS(totwt,postal,table,field, addsurcharge) ' if totwt > 40 then ' rate = int(totwt / 40) * calcshippingUPS(postal,40,table,field) ' rate = rate +calcshippingUPS(postal,totwt mod 40,table,field) ' else ' rate = calcshippingUPS(postal,totwt,table,field) ' end if ' if addsurcharge=true then ' if table = "z_ground_res" then '2005, 9.5% on everything, 2.5 on residential ' rate = rate * 1.025 ' else ' rate = rate * 1.095 ' end if ' end if ' response.write "old shipping " & rate & "
" rate=0 if subtotwt/16 > 40 then rate = int((subtotwt/16) / 40) * calcshippingUPS(postal,40,table,field) rate = rate +calcshippingUPS(postal,(subtotwt/16) mod 40,table,field) ordermmf=true else ordermmf=false rate = calcshippingUPS(postal,(subtotwt/16),table,field) end if for i = 1 to boxcount if boxes(i) > 0 then rate = rate +calcshippingUPS(postal,(boxes(i)/16) ,table,field) ordermmf=true end if next ' if addsurcharge=true then ' if table = "z_ground_res" then '2005, 9.5% on everything, 2.5 on residential ' rate = rate * 1.025 ' else ' rate = rate * 1.095 ' end if ' end if ' SURCHARGE BEING ADDED PER PACKAGE IN calcshippingUPS ' response.write "new shipping " & rate & "
" if rate > 0 then RateUPS = rate '+1.5 else rateups=0 end if end function function calcshippingUPS_ca(z,totwt,table0,table1,field) 'response.write "seeking zip " & z & " for " & totwt & " pounds in table " & table & " field " & field & "
" 'table can be ' Rates1stDayAM ' Rates1stDaySaver ' Rates2ndDay ' Rates2ndDayAM ' Rates3rdDay ' RatesGround '1.40 will be added to change from commercial rates to residential 'field can be ' Ground ' 3 Day Select ' 2nd Day Air ' 2nd Day Air AM ' Next Day Air Saver ' Next Day Air shipping = 0 'default Set t_rs2 = Server.CreateObject("ADODB.Recordset") t_rs2.open "select * from "& table0 , conn found1=false 'response.write "searching for "&z & "
" do while not t_rs2.eof z1=t_rs2("postal1") z2=t_rs2("postal2") 'a=instr(t_rs2("Postal1"),"-") 'if a > 0 then ' z1=left(t_rs2("Dest ZIP"),a-1) ' z2=mid(t_rs2("Dest ZIP"),a+1) 'else ' z1=t_rs2("Dest ZIP") ' z2=z1 'end if 'response.write "z=" & left(z,len(z1)) & " --- z1, z2 = " & z1 & ", " &z2 & "
" z=ucase(z) If z1<=left(z,len(z1)) and left(z,len(z2))<=z2 then 'response.write z1 & " <= " & left(z,len(z1)) & " --> " & (z1 &"" <= left(z,len(z1))) & "
" 'response.write left(z,len(z2)) & " <= "& z2 &" --> " & (left(z,len(z1))<= z2 & "") & "
" found1 = true exit do End If t_rs2.movenext loop 'response.write "found=" & found1 & "
" shipping =0 if found1 then 'response.write "found zip, zone = " & t_rs2(field) &"between " & z1 & " and " & z2 &"
" gr = t_rs2(field) t_rs2.close found2 = false t_rs2.open "select * from "&table1&" where [weight not to exceed]>=" & totwt &" order by [weight not to exceed]",conn if not t_rs2.eof then if isnumeric(gr) then for each f in t_rs2.fields if ucase(f.name) = "Z" & trim(gr) then shipping = t_rs2("z" & trim(gr)) 'response.write "rate= " & t_rs2("z" &trim(gr)) & "
" found2=true exit for end if next end if end if if shipping <> 0 then 'If 0, leave it that way 'if shipping < 5.45 then 'This is the minimum shipping amount 'let then handle it manually 'shipping = 5.45 'handling 'shipping = 0 'else 'shipping = shipping + 1.75 ' + 1.75 residential for 2005 'response.write "final shipping returned = " & shipping & "
" 'end if end if end if t_rs2.close set t_rs=nothing set t_rs2=nothing calcshippingUPS_ca =shipping end function function RateUPS_CA(totwt,postal,table0,table1,field, addsurcharge) ' if totwt > 40 then ' rate = int(totwt / 40) * calcshippingUPS_ca(postal,40,table0,table1,field) ' rate = rate +calcshippingUPS_ca(postal,totwt mod 40,table0,table1,field) ' else ' rate = calcshippingUPS_ca(postal,totwt,table0,table1,field) ' end if ' ' rate = rate * 1.095 '9.5 % fuel surcharge on international, 2005 ' rate=0 if subtotwt/16 > 40 then rate = int((subtotwt/16) / 40) * cdbl(calcshippingUPS_ca(postal,40,table0,table1,field)) rate = rate +cdbl(calcshippingUPS_ca(postal,(subtotwt/16) mod 40,table0,table1,field)) ordermmf=true else ordermmf=false rate = cdbl(calcshippingUPS_ca(postal,(subtotwt/16),table0,table1,field)) end if for i = 1 to boxcount if boxes(i) > 0 then rate = rate +cdbl(calcshippingUPS_ca(postal,(boxes(i)/16) ,table0,table1,field)) ordermmf=true end if next rate = rate * 1.095 if rate > 0 then RateUPS_ca = (rate +1.5) *.72 else rateups_ca = 0 end if 'if addsurcharge=true then ' if table = "z_ground_res" then '2005, 9.5% on everything, 2.5 on residential ' rate = rate * 1.025 ' else ' rate = rate * 1.095 ' end if 'end if end function function calcshippingUPS_intl(country,totwt,table0,table1,field, addsur) shipping = 0 'default Set t_rs2 = Server.CreateObject("ADODB.Recordset") t_rs2.open "select * from "& table0 & " where country ='"& country &"'", conn found1=false 'response.write "searching for "&country & "
" addsur=false if not t_rs2.eof then found1 = true if t_rs2("Surcharge")&""="Yes" then addsur=true end if 'response.write t_rs2("country") & ", " & field & "=" & t_rs2(field) & "*
" End If shipping =0 if found1 then gr = t_rs2(field) t_rs2.close found2 = false t_rs2.open "select * from "&table1&" where [weight not to exceed]>=" & totwt &" order by [weight not to exceed]",conn if not t_rs2.eof then if isnumeric(gr) then for each f in t_rs2.fields if ucase(f.name) = "Z" & trim(gr) then shipping = t_rs2("z" & trim(gr)) 'response.write "rate= " & t_rs2("z" &trim(gr)) & "
" found2=true exit for end if next end if end if if shipping <> 0 then 'If 0, leave it that way 'if shipping < 5.45 then 'This is the minimum shipping amount 'let then handle it manually 'shipping = 5.45 'handling 'shipping = 0 'else 'shipping = shipping + 1.75 ' + 1.75 residential for 2005 'response.write "final shipping returned = " & shipping & "
" 'end if end if end if t_rs2.close set t_rs=nothing set t_rs2=nothing calcshippingUPS_intl =shipping end function function RateUPS_Intl(totwt,country,table0,table1,field, addsurcharge) ' if totwt > 40 then ' rate = int(totwt / 40) * calcshippingUPS_intl(country,40,table0,table1,field) ' rate = rate +calcshippingUPS_intrl(country,totwt mod 40,table0,table1,field) ' else ' rate = calcshippingUPS_intl(country,totwt,table0,table1,field) ' end if ' rate = rate * 1.095 '9.5 % fuel surcharge on international, 2005 rate=0 dim adds, s1 if subtotwt/16 > 40 then rate = int((subtotwt/16) / 40) * calcshippingUPS_intl(country,40,table0,table1,field,adds) rate = rate + calcshippingUPS_intl(country,(subtotwt/16) mod 40,table0,table1,field, adds) if rate > 0 then if adds then s1 = int(sutbotwt/16) *.2 if s1 < 20 then s1=20 end if rate=rate + s1 end if end if ordermmf=true else ordermmf=false rate = calcshippingUPS_intl(country,(subtotwt/16),table0,table1,field,adds) if rate > 0 then if adds then s1 = int(sutbotwt/16) *.2 if s1 < 20 then s1=20 end if rate=rate + s1 end if end if end if for i = 1 to boxcount if boxes(i) > 0 then rate = rate + calcshippingUPS_intl(country,(boxes(i)/16) ,table0,table1,field,adds) if rate > 0 then if adds then s1 = int(boxes(i)/16) *.2 if s1 < 20 then s1=20 end if rate=rate + s1 end if end if ordermmf=true end if next 'rate = rate * 1.095 if rate > 0 then RateUPS_intl = (rate +1.5) *.72 else rateups_intl = 0 end if 'if addsurcharge=true then ' if table = "z_ground_res" then '2005, 9.5% on everything, 2.5 on residential ' rate = rate * 1.025 ' else ' rate = rate * 1.095 ' end if 'end if end function conn.open connstr if session("orderid") = "" then orderid="0" else orderid = session("orderid") end if if orderid = "0" then session("errmsg")="Your shopping cart is empty" response.redirect "http://www.spiritfitness.com/shop/form.asp" else rs.open "select * from orders where id = " & orderid, conn,3,3 if rs.eof then rs.close conn.close session("errmsg")="Order has not been created, can't update, please try again" response.redirect "http://www.spiritfitness.com/shop/abandon.asp" end if if rs("approved") then rs.close conn.close session("errmsg")="Order has been completed and paid for, can't update" response.redirect "http://www.spiritfitness.com/shop/abandon.asp" end if end if zip = rs("shippingzip")&"" shipcountry=rs("shippingcountry")&"" rs2.open "select count(*) from orderdetail where orderid = " & orderid, conn,3,3 count = rs2(0) rs2.close redim code(count), desc(count), qtys(count),prices(count), retprices(count) boxcount=1 current=1 redim preserve boxes(1) totwt=0 totprice=0 totqty=0 i=0 numitems=0 rs2.open "select * from orderdetail where orderid = " & orderid, conn, 3,3 do while not rs2.eof desc(i) = rs2("productid") &"" rs3.open "select * from products where id = " & rs2("productid"),conn,3,1 if not rs3.eof then qty = rs2("qty") totqty = totqty + qty unitprice = (rs3("price")) wt = rs3("weight") mmf = rs3("mmf") numitems= numitems + qty code(i)=rs3("code") desc(i)=rs3("name") if rs2("altcode") &"" <> "" then code(i)=rs2("altcode")&"" desc(i)= desc(i) & " - " &rs2("option") end if prices(i)=unitprice ''rs3("price") retprices(i)=(rs3("price")) qtys(i)=qty rs2("weight")=wt rs2("unitprice") =unitprice rs2("totalprice")=qty * unitprice if needbox then needbox=false boxcount = boxcount +1 redim preserve boxes(boxcount) boxes(boxcount)=0 current=boxcount end if if mmf then if boxes(current)=0 then boxes(current)=wt for j =2 to qty boxcount = boxcount +1 redim preserve boxes(boxcount) boxes(boxcount)=wt next needbox = true else for j =1 to qty boxcount = boxcount +1 redim preserve boxes(boxcount) boxes(boxcount)=wt next end if else subtotwt = subtotwt + wt*qty end if totwt = totwt + wt*qty totprice = totprice + unitprice * qty rs2.update i=i+1 else desc(i) = "product " & rs2("productid") & " not found" end if rs3.close rs2.movenext loop rs2.close totwt = totwt / 16 shippingcountry = rs("shippingcountry") &"" shippingstate = rs("shippingstate") &"" if isnull(rs("shipping")) then shipping = 0 else shipping = rs("shipping") end if 'if totprice > 10 then ' shipping = 175 * totqty 'end if rs("subtotalprice") = totprice rs("totalweight")= totwt 'if totprice<=15 then ' totshipping=5 'elseif totprice<= 25 then ' totshipping=6.50 'elseif totprice<= 35 then ' totshipping=7.75 'elseif totprice<= 45 then ' totshipping=8.50 'elseif totprice<= 55 then ' totshipping=10.50 'elseif totprice<= 75 then ' totshipping=11.50 'elseif totprice<= 95 then ' totshipping=13 'elseif totprice<= 150 then ' totshipping=16.50 'else ' totshipping=int(totprice*11)/100 'end if 'totshipping=int(totprice*11)/100 +5 'berghoff 'if totprice >=75 then ' totshipping =0 'else ' totshipping=int(totprice*11)/100 +5 'end if intl = false if shippingcountry <> "United States" and shippingcountry <>"US" then intl = true end if 'if shippingcountry = "United States" then ' if shippingstate= "HI" or shippingstate="HAWAII" or shippingstate="AK" or shippingstate="ALASKA" then ' totshipping = totshipping + 5 ' end if 'else ' if shippingstate <> "APO/FPO" then ' totshipping = totshipping + 10 ' end if 'end if 'if intl then ' if ucase(shippingcountry) = "CANADA" or shippingcountry = "CA" then ' shippostal=zip ' 'response.write "totwt " & totwt & "
" ' ' def=true ' table0="z_canada_standard" ' table1="z_ca_rates" ' field="zone" ' rate1 = RateUPS_ca (totwt,shippostal,table0,table1,field,true) ' theoption1 = NoZero("Canada Standard:" , rate1) ' 'response.write "ca standard "& rate1 &"
" ' ' def=true ' table0="z_canwwb" ' table1="z_expedited_zones" ' field="expedited" ' rate2 = RateUPS_ca (totwt,shippostal,table0,table1,field,true) ' theoption2 = NoZero("Canada Expedited:" , rate2) ' 'response.write "ca expedited "& rate2 &"
" ' ' def=true ' table0="z_canwwb" ' table1="z_express_zones" ' field="express" ' rate3 = RateUPS_ca (totwt,shippostal,table0,table1,field,true) ' theoption3 = NoZero("Canada Express:" , rate3) ' 'response.write "ca express "& rate3 &"
" ' ' else ' 'response.write "international
" ' ' ' ' def=true ' table0="z_worldzones" ' table1="z_express_zones" ' field="express" ' rate1 = 0 'RateUPS_intl (totwt,shipcountry,table0,table1,field,true) ' theoption1 = NoZero("Intl Express:" , rate1) ' 'response.write "intl express "& rate1 &"
" ' ' def=true ' table0="z_worldzones" ' table1="z_expedited_zones" ' field="expedited_east" ' rate2 = RateUPS_intl (totwt,shipcountry,table0,table1,field,true) ' theoption2 = NoZero("Intl Expedited:" , rate2) ' 'response.write "intl expedited "& rate2 &"
" ' ' ' def=true ' table0="z_worldzones" ' table1="z_saver" ' field="saver" ' rate3 = RateUPS_intl (totwt,shipcountry,table0,table1,field,true) ' theoption3 = NoZero("Saver:" , rate3) ' 'response.write "intl expedited "& rate2 &"
" ' ' ' ' end if 'else ' shippostal=zip ' ' def=true ' table="z_Ground_com" ' field="Ground" ' rate1 = 0 ' RateUPS (totwt,shippostal,table,field,true) ' theoption1 = NoZero("Ground:" , rate1) ' 'response.write "ground "& rate1 &"
" ' ' def=true ' table="z_3ds_com" ' field="3 Day select" ' rate2 = RateUPS (totwt,shippostal,table,field,true) ' theoption2 = NoZero("3rd Day:" , rate2) ' 'response.write "3day select "& rate2 &"
" ' ' def=true ' table="z_2da_com" ' field="2nd Day Air" ' rate3 = RateUPS (totwt,shippostal,table,field,true) ' theoption3 = NoZero("2nd Day:" , rate3) ' 'response.write "2nd day air "& rate3 &"
" ' ' def=true ' table="z_nd_com" ' field="Next Day Air" ' rate4 = RateUPS (totwt,shippostal,table,field,true) ' theoption = NoZero("Next Day:" , rate4) ' 'response.write "Next Day Air Saver "& rate4 &"
" 'end if tax = 0 'if ucase(shippingstate ) = "FL" or ucase(shippingstate )="FLORIDA" then ' tax = totprice *.07 'end if rs("tax")= tax rs.update rs.close conn.close totshipping2 = totshipping %>

Review Order

Go back to shopping cart

<%if session("errmsg") <> "" then%>
<%=session("errmsg")%>

<% session("errmsg")="" end if %>

Please review your order:

<% totsavings=0 for i = 0 to count-1 %> <% totsavings=totsavings + qtys(i)*(retprices(i)-prices(i)) next session("savings")=totsavings 'new %>
Code Name Quantity Regular Retail Price Subtotal
<%=code(i)%>  <%=desc(i)%>  <%=qtys(i)%>  <%=formatcurrency(retprices(i))%>  <%=formatcurrency(qtys(i)*prices(i))%>
Total:  <%=formatcurrency(totprice)%>
  • Curbside Delivery Only – If premium delivery options are desired please call toll-free 855-258-3555 between the hours of 8:00am to 5:00pm CST.
     

  • A 20% restock fee will be assessed for product return/refusal or order cancellation once product has shipped to delivery location.
     

  • All orders to ship within 2-3 days. Any order inquires should to be e-mailed to sales@spiritfitness.com

"> <% if hide <> true then %>

<%end if %>
<% 'response.write "subtotal shipment " & subtotwt/16 & "
" 'response.write "boxes count " & boxcount & "
" 'for i = 1 to boxcount ' response.write "box "& i &" contains "& boxes(i)/16 & "
" 'next 'response.write "total wt "& totwt & "
" %>