Jump to content
Latest News: (loading..)
Sign in to follow this  
bopper

UPS, USPS Puerto rico

Recommended Posts

Having a problem with shipping to Puerto Rico...if I enter a Puerto Rican address with United States as the country then the USPS shipping calculates right but UPS doesn't...if I enter the country as Puerto Rico (PR) then UPS calcs okay but USPS doesn't...does anyone know how to get these 2 shipping modules on the "same page" (so to speak...)

Edited by bopper

Share this post


Link to post
Share on other sites

Definite problem...

 

USPS considers Puerto Rico a state in the US and UPS considers it a separate country. I had been meaning to see if I could figure out a work around, but its still on the "To Do" list.

 

Hopefully someone will chime in who has already solved the problem.


... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Share this post


Link to post
Share on other sites

Our "solution" (and it isn't one, really) was to only offer USPS shipping to Puerto Rico--since UPS to Puerto Rico is expensive anyway. When PR customers get to Shipping Method they see three choices for USPS, and

 

United Parcel Service

We are unable to obtain a rate quote for UPS shipping.

Please contact the store if no other alternative is shown.

 

Yeah and as pointed out, for USPS customers from PR have to use a shipping address with US as country; if the country is PR, they get

 

-2147219080 - Missing value for Country.

 

A pain in the butt.


"Buy the ticket, take the ride..." -HST

Share this post


Link to post
Share on other sites

here is the USP response to my query...and my response to theirs...

 

In other words piss off eh? lol...Just find it weird that USPS considers Puerto Rico as a "state" or more to the point, a part of the US country zone and UPS treats it as a separate country. You know, many folks use the OS Commerce open source store scripts and it might be to your advantage to make your stuff work with them. I have read their forums and I am not the only one complaining about this problem. Bottom line is that if someone sets up an account with Puerto Rico in the US zone then the USPS rates show and the UPS rates don't. Bad for business, yours and mine. I will have to hack the script to make your funky sh1t work.

 

On a side note, having to wait 2 weeks to get a response from you guys doesn't win you any points either. Aplogy accepted if it was sincere, which I doubt...lol

 

Sincerely,

Ryan

 

ects@ups.com wrote:

 

>Please include the following line in all replies.

>Email Reference Number: NT20050221_0000000347

>

>Dear Ryan:

>

>Thank you for your interest in UPS. We have received your e-mail

>requesting technical support.

>

>Ryan, I apologize for any inconvenience that this issue has caused. As

>you are using a Service Provider's software, please contact your Provider

>for further support on this issue. Service Providers are web developers,

>system integrators, and IT consultants who offer customized services and

>can deliver integration services to help you implement UPS OnLine? Tools.

>UPS provides the information required by a developer to create an

>application that can interface with our systems and gather data. The end

>user application, such as the UPS components of your shopping cart, are

>completely the Service Provider's creation. I apologize if this causes

>any inconvenience.

>

Share this post


Link to post
Share on other sites

here is my fix for the Puerto rico shipping modules problem...I just covered the contingency in both the UPS and USPS shipping modules...

 

for the UPS.php shipping module:

first find this function

// class methods

function quote($method = '') {

 

then at around line 85 you will find

$this->_upsDest($order->delivery['postcode'], $order->delivery['country']['iso_code_2']);

 

change that line to a switch block for the PR case

//hack for to switch country to PR if shipping address country is US for puerto rico

if (($order->delivery['postcode'] == '00912') && ($order->delivery['country']['iso_code_2'] == 'US')) {

$this->_upsDest($order->delivery['postcode'], 'PR');

}

else {

$this->_upsDest($order->delivery['postcode'], $order->delivery['country']['iso_code_2']);

}

//end hack for to switch country to PR if shipping address country is US for puerto rico

 

that little hack will switch the country passed in to the mod to PR if the customer has set the shipping address to have the US as the country for Puerto rico

----------------------------------------------------------------------------------------------------

 

for the USPS.php shipping module

do a search on that file for

($order->delivery['country']['iso_code_2'] == 'US')

and replace that code with

(($order->delivery['country']['iso_code_2'] == 'US') || ($order->delivery['country']['iso_code_2'] == 'PR'))

 

then do a search for

($order->delivery['country']['id'] == SHIPPING_ORIGIN_COUNTRY)

and replace that code with

(($order->delivery['country']['id'] == SHIPPING_ORIGIN_COUNTRY) || ($order->delivery['country']['id'] == '172'))

 

then around line 199 you find

$request = '<IntlRateRequest USERID="' . MODULE_SHIPPING_USPS_USERID . '" PASSWORD="' . MODULE_SHIPPING_USPS_PASSWORD . '">' .

'<Package ID="0">' .

'<Pounds>' . $this->pounds . '</Pounds>' .

'<Ounces>' . $this->ounces . '</Ounces>' .

'<MailType>Package</MailType>' .

'<Country>' . $this->countries[$order->delivery['country']['iso_code_2']] . '</Country>' .

'</Package>' .

'</IntlRateRequest>';

 

replace that block with

if($this->countries[$order->delivery['country']['iso_code_2']] == 'PR') {

$strCtry = 'US';

}

else {

$strCtry = $this->countries[$order->delivery['country']['iso_code_2']];

}

$request = '<IntlRateRequest USERID="' . MODULE_SHIPPING_USPS_USERID . '" PASSWORD="' . MODULE_SHIPPING_USPS_PASSWORD . '">' .

'<Package ID="0">' .

'<Pounds>' . $this->pounds . '</Pounds>' .

'<Ounces>' . $this->ounces . '</Ounces>' .

'<MailType>Package</MailType>' .

'<Country>' . $strCtry . '</Country>' .

'</Package>' .

'</IntlRateRequest>';

 

that should allow both mods to correctly display the shipping rates no mateer whether a customer with a Puerto Rico shipping address has chosen the US or PR as the country...

the is working fine for me...should be fine for you too unless i missed an edit that I hacked into my shipping module files...let me know if it works for you...if you have any problems I will check the edits listed above with what I have done...the USPS mod was a little trickier to edit because I have the USPS methods contrib added to it...

Share this post


Link to post
Share on other sites
stand by...fixed puerto rico but broke the US...lol

 

board won't let me edit messages...anyway, the ups mod fix works fine...

got a bug in the usps hack...might not get to look at this any more until a bit later...

Share this post


Link to post
Share on other sites

doh...the problem was I was just putting in too much weight...so the code above for usps.php works fine, unless of course you submit a request to the module with too much weight...might be other constraints but that's the only one I've seen so far...carry on...

Share this post


Link to post
Share on other sites

from an exchange regarding this hack...

 

Thanks for your efforts and the alert to the answer!

One question... doesn't the hack to the UPS limit the correction only if the ZIP is 00912?

 

Good point mug! That's why it is good to compare notes...lol...

 

Yes, that UPS hack is only good for the San Juan Zip Code so far...in my small brain I was thinking PR only had one zip...lol...so far that is the only zip I have had to cover...

 

it would be simple enough to extend the conditional clause to include other PR zips, like:

(($order->delivery['postcode'] == '00912') || ($order->delivery['postcode'] == 'xxxxx') || (...))

 

but maybe there is an easier way...I will revisit this "solution"...the USPS code should work for any PR zip so it is probably better to steer the PR customer to have PR as the country rather than the USin their shipping address...

thanks for the input..

bopp out

Edited by bopper

Share this post


Link to post
Share on other sites

I changed the ups fix to this (added the state conditions to help with the filtering):

 

//hack for to switch country to PR if shipping address country is US for puerto rico

if ((($order->delivery['postcode'] == '00912') || ($order->delivery['state'] == 'Puerto Rico') || ($order->delivery['state'] == 'PR')) && ($order->delivery['country']['iso_code_2'] == 'US')) {

//echo "ctry switched<br>";

$this->_upsDest($order->delivery['postcode'], 'PR');

}

else {

$this->_upsDest($order->delivery['postcode'], $order->delivery['country']['iso_code_2']);

}

//end hack for to switch country to PR if shipping address country is US for puerto rico

Share this post


Link to post
Share on other sites
Hi, I Have the same problem, please let me know is this code resolve the problem.

 

It's a hack but so far it has resolved the problem for me. But the UPS hack only "fixes" the san juan zip...the USPS hack covers all PR cities

Share this post


Link to post
Share on other sites
It's a hack but so far it has resolved the problem for me. But the UPS hack only "fixes" the san juan zip...the USPS hack covers all PR cities

 

 

I am trying this hack, but I am getting an error on the USPS quote still.

 

The only part of the instructions that I am confused with is the second part of the usps modification.

 

then do a search for

($order->delivery['country']['id'] == SHIPPING_ORIGIN_COUNTRY)

and replace that code with

(($order->delivery['country']['id'] == SHIPPING_ORIGIN_COUNTRY) || ($order->delivery['country']['id'] ==

'172'))

 

I have ($order->delivery['country']['id'] == SHIPPING_ORIGIN_COUNTRY) on lines 193 and 306. Am I supposed to change both or just one of them, if one...which one?

 

Thank you,

David Henderson

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×