Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

USPS Intl shipping doesn't carry to confirmation


dzedward

Recommended Posts

When a customer has an international address and is checking out, they are presented with a list of available USPS shipping options to choose from. The customer can select one, then continue to the order confirmation page. However, when the customer lands on the confirmation page - the shipping option they selected doesn't appear. If you change the shipping address to the US, the shipping option you select carries over to the confirmation page.

 

Any ideas? We're running version: osCommerce 2.2-MS2.

Link to comment
Share on other sites

Not yet.

 

It seems after investigating so far that it is strictly an issue where after selecting the shipping rate, the XML is not being sent to USPS properly or it isn't being retrieved properly.

I am guessing that it is wanting the title of the USPS method along with the extra HTML code that they are including in their method titles now.

I am still looking at it.

Link to comment
Share on other sites

Yes I have had good luck.

 

There are some new USPS Methods as well here:

 

All changes are made to the usps.php file only in the "includes/modules/shipping" folder

 

Step #1:

Comment out the previous USPS Method array and add this after it:

 

/*$this->intl_types = array('Global Express Guaranteed', // edit
                               'Global Express Guaranteed Non-Document Rectangular',
                               'Global Express Guaranteed Non-Document Non-Rectangular',
                               'Express Mail International (EMS)',
                               'Express Mail International (EMS) Flat Rate Envelope',
                               'Priority Mail International',
                               'Priority Mail International Flat Rate Envelope',
                               'Priority Mail International Flat Rate Box',
                               'First-Class Mail International');*/

$this->intl_types = array(
// old rates
       'Global Express' => 'Global Express Guaranteed (GXG)**', 
       'Global Express Non-Doc Rect' => 'Global Express Guaranteed Non-Document Rectangular', 
       'Global Express Non-Doc Non-Rect' => 'Global Express Guaranteed Non-Document Non-Rectangular', 
       'USPS GXG Envelopes' => 'USPS GXG Envelopes**', 
       'Express Mail Int' => 'Express Mail International', 
       'Express Mail Int Flat Rate Env' => 'Express Mail International Flat Rate Envelope', 
       'Express Mail Int Legal' => 'Express Mail International Legal Flat Rate Envelope', 
       'Priority Mail International' => 'Priority Mail International', 
       'Priority Mail Int Flat Rate Lrg Box' => 'Priority Mail International Large Flat Rate Box', 
       'Priority Mail Int Flat Rate Med Box' => 'Priority Mail International Medium Flat Rate Box', 
       'Priority Mail Int Flat Rate Small Box' => 'Priority Mail International Small Flat Rate Box**', 
// new rates
       'Priority Mail Int DVD' => 'Priority Mail International DVD Flat Rate Box**', 
       'Priority Mail Int Lrg Video' => 'Priority Mail International Large Video Flat Rate Box**', 
// old rates
       'Priority Mail Int Flat Rate Env' => 'Priority Mail International Flat Rate Envelope**', 
// new rates
       'Priority Mail Int Legal Flat Rate Env' => 'Priority Mail International Legal Flat Rate Envelope**', 
       'Priority Mail Int Padded Flat Rate Env' => 'Priority Mail International Padded Flat Rate Envelope**', 
       'Priority Mail Int Gift Card Flat Rate Env' => 'Priority Mail International Gift Card Flat Rate Envelope**', 
       'Priority Mail Int Small Flat Rate Env' => 'Priority Mail International Small Flat Rate Envelope**',
// old rates
       'First Class Mail Int Lrg Env' => 'First-Class Mail International Large Envelope**', 
       'First Class Mail Int Package' => 'First-Class Mail International Package**', 
       'First Class Mail Int Letter' => 'First-Class Mail International Letter**' 
       );

 

Step #2:

Right before the "$response = array();" line add the two $body statements

 

// strip reg and trade out
     $body = str_replace('<sup>®</sup>', '', $body);
     $body = str_replace('<sup>™</sup>', '', $body);

     $response = array();
     while (true) {
       if ($start = strpos($body, '<Package ID=')) {
         $body = substr($body, $start);
         $end = strpos($body, '</Package>');
         $response[] = substr($body, 0, $end+10);
         $body = substr($body, $end+9);
       } else {
         break;
       }
     }

 

It should work perfectly now. Enjoy :thumbsup:

Link to comment
Share on other sites

This worked for me also but I don't want to offer all the shipping methods that it gives. How do I limit it to just Priority and Express? I have tried deleting or making them into comments but obviously I'm not doing it in the right place.

Link to comment
Share on other sites

This worked for me also but I don't want to offer all the shipping methods that it gives. How do I limit it to just Priority and Express? I have tried deleting or making them into comments but obviously I'm not doing it in the right place.

 

Just wrap this if statement around this statement near the </SvcDescription> tag.

You can add more methods as you like:

if ($service != 'Priority Mail International DVD Flat Rate Box**') {
             $rates[] = array($service => $postage);
}

Link to comment
Share on other sites

Just wrap this if statement around this statement near the </SvcDescription> tag.

You can add more methods as you like:

if ($service != 'Priority Mail International DVD Flat Rate Box**') {
             $rates[] = array($service => $postage);
}

Link to comment
Share on other sites

Thanks Hammershell, but I'm getting errors. I loaded the complete file you sent me.

 

When using a International address I get:

 

Warning: Illegal offset type in /home/ridecool/public_html/catalog/includes/modules/shipping/usps.php on line 329

 

And when I select a US address I get:

 

Warning: Illegal offset type in /home/ridecool/public_html/catalog/includes/modules/shipping/usps.php on line 293

 

Also the new file takes out the shipping options in the admin.

 

Any suggestions?

Link to comment
Share on other sites

Thank you, but can you tell me where I would put this exactly. And am I putting the services in here that I don't want? Appreciate your help.

 

Yes, these are the services that you don't want.

"!=" means 'not equal to' so it doesn't proceed to list that Service.

 

First search your usps.php file for the term '</SvcDescription>.'

A few lines after this term you will find the line '$rates[] = array($service => $postage);'

 

Replace that line with:

if ($service != 'Priority Mail International DVD Flat Rate Box**') {
             $rates[] = array($service => $postage);
}

 

Now you will remove any Service with the term -you list- that is in the $service variable.

 

You can select from these services:

       Global Express Guaranteed (GXG)** 
       Global Express Guaranteed Non-Document Rectangular 
       Global Express Guaranteed Non-Document Non-Rectangular 
       USPS GXG Envelopes**
       Express Mail International 
       Express Mail International Flat Rate Envelope 
       Express Mail International Legal Flat Rate Envelope 
       Priority Mail International
       Priority Mail International Large Flat Rate Box 
       Priority Mail International Medium Flat Rate Box 
       Priority Mail International Small Flat Rate Box** 
       Priority Mail International DVD Flat Rate Box**
       Priority Mail International Large Video Flat Rate Box** 
       Priority Mail International Flat Rate Envelope**
       Priority Mail International Legal Flat Rate Envelope** 
       Priority Mail International Padded Flat Rate Envelope**
       Priority Mail International Gift Card Flat Rate Envelope** 
       Priority Mail International Small Flat Rate Envelope**
       First-Class Mail International Large Envelope** 
       First-Class Mail International Package** 
       First-Class Mail International Letter**

 

For multiple Methods do it like this:

if ($service != 'Priority Mail International DVD Flat Rate Box**' || $service != 'First-Class Mail International Letter**') {
             $rates[] = array($service => $postage);
}

Edited by hammershell
Link to comment
Share on other sites

Thanks Hammershell, but I'm getting errors. I loaded the complete file you sent me.

 

When using a International address I get:

 

Warning: Illegal offset type in /home/ridecool/public_html/catalog/includes/modules/shipping/usps.php on line 329

 

And when I select a US address I get:

 

Warning: Illegal offset type in /home/ridecool/public_html/catalog/includes/modules/shipping/usps.php on line 293

 

Also the new file takes out the shipping options in the admin.

 

Any suggestions?

 

This isn't happening for me. Can you resend the file to me and I will test it on my store?

Link to comment
Share on other sites

Yes, these are the services that you don't want.

"!=" means 'not equal to' so it doesn't proceed to list that Service.

 

First search your usps.php file for the term '</SvcDescription>.'

A few lines after this term you will find the line '$rates[] = array($service => $postage);'

 

Replace that line with:

if ($service != 'Priority Mail International DVD Flat Rate Box**') {
             $rates[] = array($service => $postage);
}

 

Now you will remove any Service with the term -you list- that is in the $service variable.

 

You can select from these services:

       Global Express Guaranteed (GXG)** 
       Global Express Guaranteed Non-Document Rectangular 
       Global Express Guaranteed Non-Document Non-Rectangular 
       USPS GXG Envelopes**
       Express Mail International 
       Express Mail International Flat Rate Envelope 
       Express Mail International Legal Flat Rate Envelope 
       Priority Mail International
       Priority Mail International Large Flat Rate Box 
       Priority Mail International Medium Flat Rate Box 
       Priority Mail International Small Flat Rate Box** 
       Priority Mail International DVD Flat Rate Box**
       Priority Mail International Large Video Flat Rate Box** 
       Priority Mail International Flat Rate Envelope**
       Priority Mail International Legal Flat Rate Envelope** 
       Priority Mail International Padded Flat Rate Envelope**
       Priority Mail International Gift Card Flat Rate Envelope** 
       Priority Mail International Small Flat Rate Envelope**
       First-Class Mail International Large Envelope** 
       First-Class Mail International Package** 
       First-Class Mail International Letter**

 

For multiple Methods do it like this:

if ($service != 'Priority Mail International DVD Flat Rate Box**' || $service != 'First-Class Mail International Letter**') {
             $rates[] = array($service => $postage);
}

Link to comment
Share on other sites

I was unable to get it to work for multiple shipping methods as you did it. But I put the if statement for each one I didn't want and it is working.

if ($service != 'First-Class Mail International Large Envelope**')

if ($service != 'Global Express Guaranteed (GXG)**')

if ($service != 'Global Express Guaranteed Non-Document Rectangular')

 

 

Thank you so much. But now can you tell me where I do this for USPS domestic? I have a company that I normally pay to do this stuff if I can't do it myself but they are taking too long to get back to me and I need this changed asap. Plus it always makes me feel good to do it myself.

Link to comment
Share on other sites

I was unable to get it to work for multiple shipping methods as you did it. But I put the if statement for each one I didn't want and it is working.

if ($service != 'First-Class Mail International Large Envelope**')

if ($service != 'Global Express Guaranteed (GXG)**')

if ($service != 'Global Express Guaranteed Non-Document Rectangular')

 

 

Thank you so much. But now can you tell me where I do this for USPS domestic? I have a company that I normally pay to do this stuff if I can't do it myself but they are taking too long to get back to me and I need this changed asap. Plus it always makes me feel good to do it myself.

 

YEAH ME. I found it myself. This is what I did:

$this->types = array('EXPRESS' => 'Express Mail',

/*'FIRST CLASS' => 'First-Class Mail',*/

'PRIORITY' => 'Priority Mail',

'PARCEL' => 'Parcel Post');

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...