ASP ShipCalc™ Documentation

 

Functions, Variables and Rate Collection

Functions:
  • ShipCalc - Performs the real-time calculation and returns a collection of valid shipping types from any combination of selected processors.  This function takes 6 parameters including shipping companies, weight, destcountry, destcity, deststate/prov, and destzip/postal.  The shipping companies can be set UPS or USPS.
    shipcalc "UPS,USPS","10","US","Salt Lake City","UT","84115"
     
  • CountryList - This function returns a combo box of countries with values set to their valid country code.  The first parameter controls the name of the generated combobox, the second parameter takes a two digit country code which determines the default selected country.
    CountryList "DestCountry", "US"
       
  • DisplayRates - In addition to manually accessing the rates using the rates collection, ASP ShipCalc provides the displayrates function.  This automatically generates a combobox or radio button display of the rates information.  The first parameter takes the display type (combo or radio) and the second parameter sets the name of the generated form field.
    displayrates "combo","Shipping" 
     
  • CleanUpRates - This function clears any objects used in the rates collection and takes no parameters.  It should be called on the same page that ShipCalc is called after you are done with the rates collection.
    CleanUpRates
Variables:
  • RateCount - A variable which contains the number of rates in the collection after ShipCalc is called.
    response.write(ratecount)
     
  • LimitServices - A variable which contains a comma delimited string of exact service names you wish to have returned.  In order to retrieve a full list of available services run a shipcalc without this set.  You can then select any services you wish to include and enter them in a limit services string.
    LimitServices = "express, 2nd day air, parcel"
      
  • ShipCalcError - After a ShipCalc if their are any errors they will be appended to this error variable.
    response.write(ShipCalcError)

     
  • The following variables are set in usersettings.asp.  You must acquire a free username and password from the shipper(s) in order to retrieve rates.  The information provides below is a sample and not an actual username/password.
     
    'register free to get your access/uid/pwd at http://www.ec.ups.com
    UPSServer = "https://www.ups.com/ups.app/xml/Rate"
    UPSAccessLicense = "4B5ES53A91454450"
    UPSUserid = "upsusername"
    UPSPassword = "upspassword"
     
    'register free to get your uid/pwd from http://www.shippingapis.com
    USPSServer = "http://Production.ShippingAPIs.com/ShippingAPI.dll"
    USPSUserid = "356INTER3536"
    USPSPassword = "085JS02PK788"

    'shipping origin details here
    OrigCountry = "US"
    OrigCity = "Los Angeles"
    OrigStateProv = "CA"
    OrigPostal = "90039"
Rates Collection:
  • Rates Collection - After ShipCalc is called the rates collection is populated.  The rates collection includes a number of rates with Shipper, Service, Postage and Time data.  This can be accessed through the following syntax:
    for ship = 1 to ubound(rates)
      rates(ship).Item("Shipper")
      rates(ship).Item("Service")
      rates(ship).Item("Postage")
      rates(ship).Item("Time")
    next
  • Shipper - Contains the shipping company name (UPS or USPS)
  • Service - Contains the shipping service name
  • Postage - Contains the shipping postage amount
  • Time - Contains the commit time if any

 

Corporate Web Solutions 2000,2001