Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
<% 'create XML to send to UPS to gather rates
strXML= "<?xml version='1.0'?><AccessRequest xml:lang='en-US'><AccessLicenseNumber>xxxxxxxxxxxxxxxx</AccessLicenseNumber><UserId>xxxxxxxxxx</UserId><Password>xxxxxxxxxxxx</Password></AccessRequest>"
strXML=strXML & "<?xml version='1.0'?><RatingServiceSelectionRequest xml:lang='en-US'><Request><TransactionReference><CustomerContext>Rating and Service</CustomerContext><XpciVersion>1.0001</XpciVersion></TransactionReference><RequestAction>Rate</RequestAction><RequestOption>shop</RequestOption></Request>"
strXML=strXML & "<PickupType><Code>01</Code></PickupType><Shipment><Shipper><Address><PostalCode>" & strCompanyPostCode & "</PostalCode></Address></Shipper>"
strXML=strXML & "<ShipTo><Address><PostalCode>" & (request("txtShipPostCode")) & "</PostalCode></Address></ShipTo>"
strXML=strXML & "<Service><Code>11</Code></Service>"
strXML=strXML & "<Package><PackagingType><Code>02</Code><Description>Package</Description></PackagingType><Description>Rate Shopping</Description>"
strXML=strXML & "<PackageWeight><Weight>" & orderWeight & "</Weight></PackageWeight></Package>"
strXML=strXML & "<ShipmentServiceOptions/></Shipment></RatingServiceSelectionRequest>"
Set strXMLhttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
'send it
strXMLhttp.Open "POST","https://www.ups.com/ups.app/xml/Rate?",false
strXMLhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
strXMLhttp.send strXML
'pull any shipping surcharges from the database that we set up.
BDSQL="Select fldShipping from tblShipping where fldVisible=1;"
set BDTemp=BDConn.execute(BDSQL)
IF BDTemp.EOF THEN
strChosen=0
else
strChosen=BDTemp("fldShipping")
END IF
'the response from UPS
strXMLResponse = strXMLhttp.responseText
Set mydoc=Server.CreateObject("Microsoft.xmlDOM")
mydoc.loadxml(strXMLResponse)
'Create A Nodelist of All The RatedShipments
Set NodeList = mydoc.documentElement.selectNodes("RatedShipment")
For strCount = 0 To NodeList.length - 1
'Service/Code
'put into session value any codes we choose to use - being Next day, 2nd day, 3 day and ground.
Select case NodeList.Item(strCount).selectSingleNode("Service/Code").Text
case "01"
session("svUPS3")="UPS Next Day Air"
session("svUPSCost3")=(cdbl(NodeList.Item(strCount).selectSingleNode("TotalCharges/MonetaryValue").Text)+cdbl(strChosen))
session("svUPSOrder3")=3
strCount2=strCount2+1
case "02"
session("svUPS2")="UPS 2nd Day Air"
session("svUPSCost2")=(cdbl(NodeList.Item(strCount).selectSingleNode("TotalCharges/MonetaryValue").Text)+cdbl(strChosen))
session("svUPSOrder2")=2
strCount2=strCount2+1
case "12"
session("svUPS1")="UPS 3 Day Select"
session("svUPSCost1")=(cdbl(NodeList.Item(strCount).selectSingleNode("TotalCharges/MonetaryValue").Text)+cdbl(strChosen))
session("svUPSOrder1")=1
strCount2=strCount2+1
case "03"
session("svUPS0")="UPS Ground"
session("svUPSCost0")=(cdbl(NodeList.Item(strCount).selectSingleNode("TotalCharges/MonetaryValue").Text )+cdbl(strChosen))
session("svUPSOrder0")=0
strCount2=strCount2+1
END SELECT
NEXT
session("svCount")=clng(strCount2)
'Create a select table from the response xml
response.Write("<select name=""txtShipping"" class=""searchfield"">") & vbcrlf
IF (request("txtShipping"))="0" or (request("txtShipping"))="" or (request("txtshipping"))=" " or isNULL((request("txtshipping"))) THEN
response.write "<Option value=""0"" selected><-- Select Shipping --></option>" & vbcrlf
ELSE
response.write "<Option value=""0""><-- Select Shipping --></option>" & vbcrlf
END IF
'TotalCharges/MonetaryValue
For strCount=0 to (clng(session("svCount"))-1)
IF (request("txtShipping"))= Session("svUPS"&strCount) THEN
response.write("<option value=""" & Session("svUPS"&strCount) & """ selected>")
ELSE
response.write("<option value=""" & Session("svUPS"&strCount) & """>")
END IF
response.write Session("svUPS"&strCount) & " - " & formatcurrency((Session("svUPSCost"&strCount)),2)
response.write("</option>") & vbcrlf
Next
response.Write("</select>") & vbcrlf