UPS Realtime Package Dimensions

UPS Realtime Package Dimensions

If you are having trouble with UPS not having the product dimensions calculated correctly before requesting the rates, the following code may help. It multiplies the dimensions by the number of products you have and works out the correct dimensions for a package containing all items purchased.

Add this to the top of upsxmlrealtime.asp below the other DIM statements

Dim totdim1, totdim2, totdim3, totalvolume, cubed1

Then, locate the following code -

If getupsconfig("xdimensionfield",false, dbc)<>"" then
tempdimensions=rs(getupsconfig("xdimensionfield",false, dbc))
if not isnull(tempdimensions) then
productdimensions=tempdimensions
end if
end if

Change to -

If getupsconfig("xdimensionfield",false, dbc)<>"" then
tempdimensions=rs(getupsconfig("xdimensionfield",false, dbc))

if not isnull(tempdimensions) then
productdimensions=tempdimensions

dim tempdim1, tempdim2, tempdim3, tempdim4
tempdim1 = left(productdimensions, instr(productdimensions, " ") - 1)
tempdim2 = right(productdimensions, len(productdimensions) - instr(productdimensions, " "))
tempdim3 = left(tempdim2, instr(tempdim2, " ") -1)
tempdim4 = right(tempdim2, instr(tempdim2, " ") -1)
totdim1=totdim1 + (tempdim1 * prodquantity)

if tempdim3>totdim2 then
totdim2=tempdim3
else
totdim2=totdim2
end if

if tempdim4>totdim3 then
totdim3=tempdim4
else
totdim3=totdim3
end if

totalvolume = int(totdim1 * totdim2 * totdim3)
cubed1 = int(totalvolume ^ (1/3))
productdimensions = cubed1 & " " & cubed1 & " " & cubed1
end if
end if

Please note: this code was supplied by a customer and VP-ASP offers no guarantees that it will work correctly and we do not offer support for this code.

However, if you have large-sized products, UPS might return an error about the over-sized dimensions.

The solution to this issue is to configure UPS so that large sized products will be shipped separately.

To configure this, please log into your administration page, select Occasional Task and then click at Shipping.

Select configure UPS and than make sure that Allow certain products to be shipped separately? is enabled.

Now, go to View/Edit product page and then click the edit button for a large-sized product. Please enter the value "YES" to the "Other5" field. This will mark this product to be shipped separately.

If your "other5" field is already used for other purposes, you can set UPS to use another field. Simply enter the name of the field to the "Dimension Product Field" at UPS configuration page.


Times Viewed:
3303
Added By:
Claire Banks
Date Created:
6/6/2007
Last Updated:
9/23/2008