<%@ Language=VBScript %> <% '************************************************************************* ' DO NOT MODIFY THIS SCRIPT IF YOU WANT UPDATES TO WORK! ' Function : USPS Online Shipping Rates ' Product : CandyPress Store Administration ' Version : 2.5 ' Modified : February 2004 ' Copyright: Copyright (C) 2004 CandyPress.Com ' See "license.txt" for this product for details regarding ' licensing, usage, disclaimers, distribution and general ' copyright requirements. If you don't have a copy of this ' file, you may request one at webmaster@candypress.com '************************************************************************* Option explicit Response.Buffer = true const adminLevel = 0 %> <% 'Form variables dim USPSactive dim USPSUserID dim USPSPassword dim USPSfromZip dim USPSservice dim USPSintNtl dim USPSsize dim USPSmachinable 'Database variables dim mySQL, cn, rs 'Work Fields dim serviceArray dim xmlTest '************************************************************************* 'Open Database call openDb() 'Store Configuration if loadConfig() = false then response.redirect "sysMsg.asp?errMsg=" & server.URLEncode("Could not load Store Configuration settings.") end if 'Get current configuration settings from database mySQL = "SELECT configVar, configVal " _ & "FROM storeAdmin " _ & "WHERE adminType = 'S'" set rs = openRSexecute(mySQL) do while not rs.EOF select case trim(lCase(rs("configVar"))) case lCase("USPSactive") USPSactive = rs("configVal") case lCase("USPSUserID") USPSUserID = rs("configVal") case lCase("USPSPassword") USPSPassword = rs("configVal") case lCase("USPSfromZip") USPSfromZip = rs("configVal") case lCase("USPSservice") USPSservice = rs("configVal") case lCase("USPSintNtl") USPSintNtl = rs("configVal") case lCase("USPSsize") USPSsize = rs("configVal") case lCase("USPSmachinable") USPSmachinable = rs("configVal") end select rs.MoveNext loop call closeRS(rs) 'Close Database call closedb() 'Create service array serviceArray = split(USPSservice,",") %>

Shipping - USPS Online Shipping Rates

<% 'Page Tabs call shipTabs("US") if len(trim(Request.QueryString("msg"))) > 0 then %> <%=Request.QueryString("msg")%>

<% end if %> Notes :
Note 1. Stores that sell irregularly shaped or oversized items requiring additional shipping charges may find that the shipping rates returned by USPS are not adjusted for these items. Always enter a few typical test orders to verify that you are getting the shipping rate results you want.
Note 2. The rates returned by this routine will always be in US dollars.
Note 3. USPS currently only provide shipping for packages that originate from within the United States.

Step-By-Step :
Step 1. XML - Your web server must be able to communicate with the USPS servers via Microsoft's XML components. Checking for XML components --> <% on error resume next set xmlTest = Server.CreateObject("Microsoft.XMLDOM") if err.number = 0 then set xmlTest = server.Createobject(MSXMLprogID) if err.number = 0 then Response.Write "COMPONENTS INSTALLED" else Response.Write "MSXML NOT FOUND" end if else Response.Write "XMLDOM NOT FOUND" end if set xmlTest = nothing on error goto 0 %>
Step 2. IIS 5.0 - You will need to have IIS 5.0 (or later) to use the shipping routine. You currently have <%=Request.ServerVariables("SERVER_SOFTWARE")%> installed.
Step 3. SHIPMENT WEIGHT - The weight of your products must be entered into your database as Pounds. Ounces must be entered as fractions of a Pound (1oz = 0.0625Lbs, 1Lbs 8oz = 1.5Lbs, etc.).
Step 4. LOCAL SHIPPING - Check that the Country Code for the United States is "US", and Puerto Rico is "PR", using the Locations function. This is the default value.
Step 5. COUNTRY NAMES - USPS uses the country name to determine the shipping rates for non-US destinations. The country name in the Locations file must therefore match the country name USPS expects to receive. The full list can be found HERE.
Step 6. USPS ACCOUNT - Before proceeding to the next step, you must REGISTER with USPS. You will initially receive a test account, but you can go ahead and request a live account as the routines have already been tested.
Step 7. CONFIGURE - Complete the form below to configure your store for USPS Online Rates.

Active? > (Check box to activate Online USPS rates)
USPS User Name (Value is case sensitive)
USPS Password (Value is case sensitive)
Zip/Post Code (Origination Zip/Post Code)
Select US Services >Express   >First Class   >Priority   >Parcel  
Ship International? (Allow shipping outside US?)
Package Size (See USPS Documentation)
Machinable? (See USPS Documentation)





<% '********************************************************************* 'Check an array for a value and return requested string '********************************************************************* function checkArr(arr, strVal, strRet) dim i for i = 0 to Ubound(arr) if LCase(arr(i)) = LCase(strVal) then checkArr = strRet exit for end if next end function %>