"
'Cart Flat Rate Shipping
If PartID = "JRCART" OR PartID = "BIGCART" Then
CARTS = CARTS + Quantity
End If
'Response.Write CARTS & ":"
If PartID = "Chrome" Then
CARTSCC = CARTSCC + Quantity
End If
'Response.Write CARTSCC & ":cc "
ScootsDB.MoveNext
Loop
ScootsDB.Close
Set ScootsDB = Nothing
If Request.Form("zipcode") <> "" Then
zip2 = Request.Form("zipcode")
Session("zipcode") = zip2
End If
If Session("zipcode") <> "" Then
Session("zonecode") = Left(Session("zipcode"),3)
Place = 96
For i = 0 to 96
If cInt(ZoneArray(0,i)) > cInt(Session("zonecode")) Then
Place = i-1
i = 999
End If
Next
Session("Zone") = ZoneArray(1,Place)
Shipcost1 = 0
If CARTS < 25 AND CARTS <> 0 Then
strSQL = "SELECT * FROM Shipping WHERE Zone = " & cInt(Session("Zone")) & ";"
'Response.Write strSQL
Set ScootsDB = ScootsConn.Execute(strSQL)
If NOT ScootsDB.EOF Then
Shipcost1 = Shipcost1 + ScootsDB(CARTS)
'Response.Write Shipcost1 & ":"
Else
'Response.Write " Bad Session"
End If
ScootsDB.Close
Set ScootsDB = Nothing
End If
If CARTSCC < 25 AND CARTSCC <> 0 Then
strSQL = "SELECT * FROM ShippingCC WHERE Zone = " & cInt(Session("Zone")) & ";"
'Response.Write strSQL
Set ScootsDB = ScootsConn.Execute(strSQL)
If NOT ScootsDB.EOF Then
Shipcost1 = Shipcost1 + ScootsDB(CARTSCC)
'Response.Write Shipcost1 & ":"
Else
'Response.Write " Bad Session"
End If
ScootsDB.Close
Set ScootsDB = Nothing
End If
End If
Session("Weight") = Weight
Else
%>
No products added yet!
<%
End If
'UPS Shipping
'Response.Write "
"
If (Request.Form("zipcode") <> "" OR Session("zipcode") <> "") AND Weight <> 0 Then
Function getShipMethod(shipCode)
getShipMethod = "Unknown"
if shipCode = "01" then getShipMethod = "Next Day Air"
if shipCode = "02" then getShipMethod = "2nd Day Air"
if shipCode = "03" then getShipMethod = "Ground"
if shipCode = "07" then getShipMethod = "Worldwide Express"
if shipCode = "08" then getShipMethod = "Worldwide Expedited"
if shipCode = "11" then getShipMethod = "Standard"
if shipCode = "12" then getShipMethod = "3-Day Select"
if shipCode = "13" then getShipMethod = "Next Day Air Saver"
if shipCode = "14" then getShipMethod = "Next Day Air Early AM"
if shipCode = "54" then getShipMethod = "Worldwide Express Plus"
if shipCode = "59" then getShipMethod = "2nd Day Air AM"
if shipCode = "65" then getShipMethod = "Express Saver"
End Function
Dim mydoc
Set mydoc=Server.CreateObject("Microsoft.XMLDOM")
mydoc.async=false
Dim objXMLHTTP, xmlhttp
Set xmlhttp = Server.CreateObject("Microsoft.XMLHTTP")
upsurl = "https://www.ups.com/ups.app/xml/Rate"
If Weight = 0 Then
Weight = 1
End If
zip1 = "92845"
zip2 = Session("zipcode")
If Len(zip2) = 3 Then
zip2 = zip2 & "00"
Session("zipcode") = zip2
End If
country = "US"
'response.write "Weight: " & Weight & " "
'response.write "Source Postal Code: " & zip1 & " "
'response.write "Destionatinon Country Code: " & country & " "
'response.write "Destination Postal Code: " & zip2 & " "
first = "checked"
if cdbl(weight) <= 150 then
upsxml = "9B9B1F8DC51DF902REG111111REG111111Rating and Service1.0001Rateshop01" & zip1
upsxml = upsxml & "" & zip2 & "" & country & "11"
upsxml = upsxml & "02PackageRate Shopping" & weight & ""
'upsxml = upsxml & "02PackageRate Shopping" & weight & ""
upsxml = upsxml & ""
xmlhttp.Open "POST", upsurl, false
xmlhttp.Send(upsxml)
xmlresponse = xmlhttp.responseText
mydoc.loadxml(xmlhttp.responseText)
if mydoc.parseError.errorcode <> 0 then
response.write "The xml document is not well-formed"
else
'Response.write "Here is the rate information returned LIVE in REAL TIME from the UPS server:
"
Set Root = mydoc.documentElement
'Check to make sure it was a success
Set NodeList = Root.getElementsByTagName("ResponseStatusDescription")
For Each Elem in NodeList
result = Elem.firstChild.nodeValue
'response.write "The request was a " & result & " "
if result = "Failure" then
Set NodeList = Root.getElementsByTagName("ErrorDescription")
For Each ErrorText in NodeList
'response.write ErrorText.firstChild.nodeValue & " Click here to fix your zipcode."
next
else
'Request was successfully processed, display the rates
'response.write " "
set nodes=mydoc.selectNodes("RatingServiceSelectionResponse/RatedShipment")
for i = 0 to nodes.length - 1
set codes = nodes(i).selectNodes("Service/Code")
'''Response.write "
UPS " & getshipmethod(codes(0).text) & ":
"
set codes1 = nodes(i).selectNodes("TotalCharges/MonetaryValue")
set ground = nodes(0).selectNodes("TotalCharges/MonetaryValue")
' If i=0 and realprice >= 25 and Weight < 50 then
' codes1(0).text = cCur(0)
' i = nodes.length
' ElseIf i=0 and realprice < 25 and Weight < 50 then
' codes1(0).text = cCur(8.00)
' i = nodes.length
' End If
'''Response.write "
"
' If realprice >= 25 and Weight < 50 then
' Response.Write "FREE!"
' Else
'''Response.Write "$" & formatnumber(codes1(0).text,2)
' End If
'''Response.Write "
"
If first <> "" Then
first = ""
End If
next
shiptext1 = ground(0).text
end if
Next
end if
else
'Total shipment is over 150 lbs
Dim weights(), requests(), responses(), rates(), grounds()
numpackages = fix((weight - 1) / 150)
redim weights(numpackages)
redim requests(numpackages)
redim responses(numpackages)
redim rates(6)
redim grounds(0)
'Response.write " Total rates for " & fix((weight - 1) / 150) + 1 & " packages:
"
for i = 0 to numpackages
if i <> numpackages then
weights(i) = 150
else
weights(i) = (weight mod 150)
if weights(i) = 0 then weights(i) = 150
end if
requests(i) = "9B9B1F8DC51DF902REG111111REG111111Rating and Service1.0001Rateshop01" & zip1 & "" & zip2 & "" & country & "1102PackageRate Shopping" & weights(i) & ""
xmlhttp.Open "POST", upsurl, false
xmlhttp.Send(requests(i))
responses(i) = xmlhttp.responseText
mydoc.loadxml(responses(i))
if mydoc.parseError.errorcode<>0 then
response.write "The xml document is not well-formed"
else
Set Root = mydoc.documentElement
'Check to make sure it was a success
Set NodeList = Root.getElementsByTagName("ResponseStatusDescription")
For Each Elem in NodeList
result = Elem.firstChild.nodeValue
if result = "Failure" then
Set NodeList = Root.getElementsByTagName("ErrorDescription")
For Each ErrorText in NodeList
'response.write ErrorText.firstChild.nodeValue & " Click here to fix your zipcode."
next
else
'Request was successfully processed, display the rates
set nodes=mydoc.selectNodes("RatingServiceSelectionResponse/RatedShipment")
for j = 0 to nodes.length - 1
set codes = nodes(j).selectNodes("Service/Code")
if i = numpackages then
'''Response.write "
UPS " & getshipmethod(codes(0).text) & ":
"
end if
set codes1 = nodes(j).selectNodes("TotalCharges/MonetaryValue")
set ground = nodes(0).selectNodes("TotalCharges/MonetaryValue")
grounds(0) = cdbl(rates(0)) + cdbl(ground(0).text)
rates(j) = cdbl(rates(j)) + cdbl(codes1(0).text)
if i = numpackages then
'''Response.write "
$" & formatnumber(rates(j),2) & "
"
If first <> "" Then
first = ""
End If
end if
next
shiptext1 = rates(0)
end if
Next
end if
next
end if
'End UPS Shipping
Else
shiptext1 = 0
End If
strSQL = "SELECT TotalQuant, TotalPrice FROM Cart WHERE CartID LIKE '" & CookCartID & "'"
Set ScootsDB = ScootsConn.Execute(strSQL)
If NOT ScootsDB.EOF Then
'Response.Write "TP: " & ScootsDB("TotalPrice") & " "
'Response.Write "st1: " & shiptext1 & " "
'Response.Write "sc1: " & Shipcost1 & " "
'Response.Write "sc2: " & Shipcost2 & " "
Response.Write "