VP-ASP :: Shopping Cart Software

Shopping Cart Software Solutions for anywhere in the World

US/Canada(Toll Free): +1 888 587 2278
Europe/UK: +44 (020) 7193 9408
Australia/New Zealand: +61 3 9016 4497

VP-ASP Shopping Cart Customer Forum

Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VPCart Forum
 Add-ons for VP-ASP
 Pounds error using uspostalrealtime.asp
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Vito Manzione
Starting Member

20 Posts

Posted - February 02 2006 :  11:03:48  Show Profile  Reply with Quote
We had been using UPS for the longest time but decided to start using USPS. We went through the tests with the postal service and everything looked ok. We entered the appropriate fields in the file and setup a shipping record in the system.

When we try to process using USPS shipping method we get and error that says "Please enter a valid weight in pounds".

Any ideas, we can't seem to find our why this is happening.

dandlyin
VP-ASP New User

USA
73 Posts

Posted - February 03 2006 :  05:12:31  Show Profile  Visit dandlyin's Homepage  Reply with Quote
The USPS system requires weight in pounds and ounces. If your weights are not whole numbers, you will see the message you described. The script looks at field 'pother4' for ounces and assumes the values in 'weight' will be integers.
My weights are not integers and I have no values in pother4. Consequently, I hacked the script to convert my weights to pounds and ounces before the script submits them to the USPS system. You may need to do something similar. Look at uspostalrealtime.asp around lines 213 and 230 (you need to do it in two places).
Hope this helps you.
Dan Dotson
Go to Top of Page

Vito Manzione
Starting Member

20 Posts

Posted - February 03 2006 :  06:30:27  Show Profile  Reply with Quote
Thanks for the feedback, can I ask how you changed your code ? I might be having the same problem.
Go to Top of Page

dandlyin
VP-ASP New User

USA
73 Posts

Posted - February 03 2006 :  08:41:07  Show Profile  Visit dandlyin's Homepage  Reply with Quote
This is a major change in the script. Back up your old copy before you proceed!

about line 186 you should see this line:
dim i, tempzip

about line 223 you should see this line:
If singleweight>0 or singleweightounces> 0 then

Replace everything BETWEEN THOSE LINES (leave those lines as they are!) with these:

'*************added tmpweight to dimension statement
dim weight,tmpweight
dim supplierid, singleweight
Dim calculate, deliveryarray
dim prodfeatures
singleweight=0
singleweightounces=0
totalounces=0
scartItem = getsess("cartcount")
arrCart = getsessa("cartarray")
' go through all products
calculate=false
For i = 1 to scartItem
prodid=arrCart(cProductid,i)
prodname= arrCart(cProductname,i)
Prodquantity=arrCart(cQuantity,i)
ProdPrice=arrCart(cUnitPrice, i)
Deliveryarray=arrcart(cDelivery,i)
Individualquantity=prodquantity
prodfeatures= arrCart(cProductfeatures,i)
calculate=CheckDeliveryFree (dbc, prodid)
if calculate=true then
Getproductweight prodid, prodquantity, weight, supplierid, ounces, prodfeatures
Calculate=CheckDeliverySelf(deliveryArray)
If Calculate=false Then ' individual calculation
'*************added line to save weight value
tmpweight=weight
'*************end added line
If weight>0 or ounces>0 then
GetShippingzip supplierid, Deliveryarray
'*************added block
If weight > int(weight) then
ounces=(weight-int(weight))*16
If ounces > int(ounces) then
ounces=int(ounces)+1
end if
weight=int(weight)
end if
'*************end added block
GetuspsRates weight, Shiptozip, shiptocountry, shipfromzip, ounces
'*************changed next statement to use tmpweight for sum
TotalWeight=tmpweight+totalweight
'*************end edited line
Totalounces=ounces+totalounces
end if
else
singleweight=singleweight+ weight
singleweightounces=singleweightounces+ounces
end if
end if
Next
'*************added block
If singleweight > int(singleweight) then
singleweightounces=(singleweight-int(singleweight))*16
If singleweightounces > int(singleweightounces) then
singleweightounces=int(singleweightounces)+1
if singleweightounces=>16 then
singleweight=singleweight+1
singleweightounces=singleweightounces-16
end if
end if
singleweight=int(singleweight)
else
singleweightounces=0
end if
'***********end added block

I have not tested this in the scenario where the items' freight costs are computed individually but I think it should work.

I hope this helps you. As always, I disclaim responsibility if it does not work for everyone in all cases- and welcome feedback regarding the suggested changes.
Dan Dotson
Go to Top of Page

Vito Manzione
Starting Member

20 Posts

Posted - February 03 2006 :  09:38:54  Show Profile  Reply with Quote
I appreciate the help but the code did not work for us.

We did do a test however and if we changed an item to just pounds with no ounces it does work. This of course is not a good solution for us so we will have to figure out how to get around it. It just seems odd that the code would even work this way.

Curious if anyone else had this problem also.
Go to Top of Page

dandlyin
VP-ASP New User

USA
73 Posts

Posted - February 03 2006 :  09:54:45  Show Profile  Visit dandlyin's Homepage  Reply with Quote
Just curious- what happened when you tried the new script?
Thanks,
Dan
Go to Top of Page

Vito Manzione
Starting Member

20 Posts

Posted - February 03 2006 :  11:30:47  Show Profile  Reply with Quote
It came back with a process error and that I should contact my administrator.

I am pretty sure I had the code in correctly.
Go to Top of Page

dandlyin
VP-ASP New User

USA
73 Posts

Posted - February 03 2006 :  14:03:27  Show Profile  Visit dandlyin's Homepage  Reply with Quote
Is there a chance you have your weights in comma delimited form? eg. 2,7 vs. 2.7. That would cause a problem. Otherwise, I have no idea why it did not run for you.
Sorry- but at least you now know the source of your problem!
Good luck with a solution.
Dan Dotson
Go to Top of Page

Vito Manzione
Starting Member

20 Posts

Posted - February 03 2006 :  14:53:59  Show Profile  Reply with Quote
Yeah, I tried it again and it still seems to bomb.

I guess the next best thing to do is change all my weights to whole numbers. Damn, that just doesn't seem right.

Thanks for the help though, appreciate it.
Go to Top of Page

dandlyin
VP-ASP New User

USA
73 Posts

Posted - February 03 2006 :  18:26:13  Show Profile  Visit dandlyin's Homepage  Reply with Quote
I should have mentioned the file we are working with
It's uspostalrealtime.asp.
Dan
Go to Top of Page

Vito Manzione
Starting Member

20 Posts

Posted - February 04 2006 :  09:01:09  Show Profile  Reply with Quote
Yeah, that's the same file I thought you meant.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000