Jump to content
fulluvscents

USPS Rate V4, Intl Rate V2 (official support thread)

Recommended Posts

Show free shiping with other shipping options looks like it will work for you. I haven't used this module, but I'm not sure the one I'm using will work with 2.3.4BS. In case this one doesn't work, there are others in the Addons section that you can try.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

@@kymation

 

As always you are a big help.  I've tagged that add on suggestion, and it seems to be what I'm looking for.  I will give it the old college try. 

Again Thanks for you help and pointing me in the direction needed.

 

Dean

Share this post


Link to post
Share on other sites

And the wonderful USPS has decided to change things yet again. During the Christmas season. Well, just after it anyway -- the deadline is January 17, 2016. You can get the change documentation here.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Just a note for people use the older MS2.2 / Rc2a USPS V4 module there are service name changes to Domestic you will need to make changing Standard Post to Retail Ground.  It will be in several places in the code.


 


Also the name changes from being Registered Mark to a Trademark.


 


'USPS Retail Ground tradmrk' => 'USPS Retail Ground tradmrk',


 


Uninstall and reinstall to test.   Don't forget to keep your USPS ID to add back when you reinstall.


 


See https://www.usps.com...lease-notes.rtf


 


Other changes (Flat Rate boxes as a container) do not seem to impact the old module.


 


Switch your current module to $usps_server = 'stg-production.shippingapis.com' to test impact



Kym

Projects Director @ ozEworks.com

Share this post


Link to post
Share on other sites

 

'USPS Retail Ground tradmrk' => 'USPS Retail Ground tradmrk',

 

Kym,

 

Where does this line in your post go?  Is it replacing code, or is it new?

 

Ron

Share this post


Link to post
Share on other sites

Kym,

 

Where does this line in your post go?  Is it replacing code, or is it new?

 

Ron

 

It'll be replacing code and it's not just that one line. Two lines need to change, and you'll need to uninstall and reinstall the module for it to accept those changes (because the changes affect how the shipping module installs the new USPS Retail Ground). Will likely post an updated module on Sunday evening for this since I already have it working in testing, although I still think people should just use Priority Mail.

 

But if you want to change it sooner (although the change won't be visible until January 17, 2016), for this particular module, all two instances of Standard PostRM should be replaced with USPS Retail GroundTM

 

For the most part the USPS API changes won't affect most users, with the exception of First-Class Mail Parcel for shipments within the USA. The test server hasn't updated the new 16 ounce limit. And the current module is coded to only 13 ounces. That is a very simple 1-line change where in includes/modules/shipping/usps.php you find 13/16 and change it to 16/16

Share this post


Link to post
Share on other sites

Updated the module. Only the includes/modules/shipping/usps.php file needs to be updated if you had the latest version prior to this new one.

 

It looks like the new First-Class weight limit isn't in full effect anywhere. When USPS realizes this oversight and changes it, this module update will allow the new weight limits.

 

One very important note is that the new defaulted pricing is Retail, not Online. This is because Commercial Base is being phased out, which means if you don't have a third-party postage provider account then you won't be getting discounted postage anyways. One less reason to use USPS' own Click-N-Ship now.

Share this post


Link to post
Share on other sites

Hey Kevin, my older (USPS Rate V4 Intl Rate V2 - v.1.7 on osCMax v2.0.25 - also older) is working, I suspect its because of the limited options I use (FC parcel and priority) but I'd like to get current.. should I just change the 13/16 to 16/16 and the wording on the Standard Post® to USPS Retail Ground™ or upgrade?? I don't have a http.php file in my files at all.. and searching some of the routines, I dont seem to have any of that going on anywhere!!


Debbie D
Franklin County, VA "Moonshine Capitol of the World"
osCmax Mobile Template oscmaxtemplates.com

Share this post


Link to post
Share on other sites

Hey Kevin, my older (USPS Rate V4 Intl Rate V2 - v.1.7 on osCMax v2.0.25 - also older) is working, I suspect its because of the limited options I use (FC parcel and priority) but I'd like to get current.. should I just change the 13/16 to 16/16 and the wording on the Standard Post® to USPS Retail Ground™ or upgrade?? I don't have a http.php file in my files at all.. and searching some of the routines, I dont seem to have any of that going on anywhere!!

 

I would make any necessary line-by-line changes on the usps.php file that applies to you, since fortunately this is not a major upgrade. You don't even need to make updates for the Retail Ground services if you don't use them. The new 16/16 weight limit is probably required if you use Online, not Retail, rates since you can finally ship parcels under a pound.

 

If what you have works for you, I wouldn't do anything ultra crazy and risk it breaking afterwards. Perhaps the next USPS change will prove more complicated.

Share this post


Link to post
Share on other sites

I used to have this module, and last time I upgraded, I think I switched to USPS methods accidentally.   All worked until this January's usps changes.

 

I upgraded and replaced all files to this add-on, uninstalled and re-installed.  I have retail rates option selected not online.
 
Now if I am trying to place an order from the front end- Retail Ground is not showing up (Is selected in settings).
 
However, if I go to the back-end and use order editor to modify any existing orders it will show up for me, but not for my customers.

 

The backend did not work until I added this to modules.php(per the readme.txt), is there something similar that needs to be added to the front-end?

// USPS START

//        $contents[] = array('text' => '<br>' . $keys);

        $contents[] = array('text' => '<br />' . preg_replace(array('/RM/', '/TM/', '/International/', '/Envelope/'), array('®', '™', 'Intl', 'Env'), $keys));

// USPS END
Edited by IWAS

Share this post


Link to post
Share on other sites

USPS has added a lot of restrictions to Retail Ground. You will probably not get a quote unless the customer is a long distance from you. Try shipping a product across the country and see if it works. Otherwise I suggest that you just use Priority.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

USPS has added a lot of restrictions to Retail Ground. You will probably not get a quote unless the customer is a long distance from you. Try shipping a product across the country and see if it works. Otherwise I suggest that you just use Priority.

 

Regards

Jim

 

 

Thanks, tried changing the address to far away, and Retail Ground showed up.  :)

Share this post


Link to post
Share on other sites

You can get Retail Ground to show up for all customers if you are willing to pay for Hazmat, Live Animals, or Oversize riders. These will generally make it more expensive than Priority. Since the module does not know how far away the customer is, the riders would probably have to be applied to all customers. I don't see a good solution here.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

I'm OK with how it is.  Priority was usually the same price for customers that were nearby when it was parcel select, especially for lighter packages.  And I offer UPS too so it is all good.

Share this post


Link to post
Share on other sites

So first off, I want to say thank you to the community for keeping up with this module.

Second, I want to say thank you to the developer for keeping my original idea alive for weight thresholds for shipping services since my work on v3 API

Good job and this is much better than I could have done so kudos!  Love the idea to use the store owner email.  I posted an update once and left my email in the module code.  OOPS!  With this change it will never happen again :)

Lastly, I want to apologize for ditching the community after changing to v3 and never finishing the module.  But I'm glad someone took over and they did a good job.

Share this post


Link to post
Share on other sites

My website uses osCmax. My usps.php file has this:

 

 if( preg_match( '#First\-Class#', $request_type ) && $this->usps_weight < 16/16 ) {

            $service = 'First Class';

 

but customers still are not getting quotes for First Class when their cart shows weights of from 14 to 16 ounces. It is showing only Priority Mail. Does something else need to be changed? Shouldn't they be getting quotes for First Class Mail? Otherwise everything works fine.

Share this post


Link to post
Share on other sites

My website uses osCmax. My usps.php file has this:

 

 if( preg_match( '#First\-Class#', $request_type ) && $this->usps_weight < 16/16 ) {

            $service = 'First Class';

 

but customers still are not getting quotes for First Class when their cart shows weights of from 14 to 16 ounces. It is showing only Priority Mail. Does something else need to be changed? Shouldn't they be getting quotes for First Class Mail? Otherwise everything works fine.

 

So upon further review of the USPS API it appears that they restricted pulling rates to only 13 ounces. So even though you can go to the post office and ship a 1 pound item, you can't use their online postage calculator to estimate postage costs for anything over 13 ounces.

 

My only solution to this was to utilize and modify the Table shipping method that's already within osC.

 

 

So first off, I want to say thank you to the community for keeping up with this module.

Second, I want to say thank you to the developer for keeping my original idea alive for weight thresholds for shipping services since my work on v3 API

Good job and this is much better than I could have done so kudos!  Love the idea to use the store owner email.  I posted an update once and left my email in the module code.  OOPS!  With this change it will never happen again :)

Lastly, I want to apologize for ditching the community after changing to v3 and never finishing the module.  But I'm glad someone took over and they did a good job.

 

Props for still being alive. This module is still pretty great. Thanks for all your hard work many years ago!

Share this post


Link to post
Share on other sites

Does anyone know of any ways (tricks?) to use the flat rate envelopes or flat rate shipping if they order only one or two items? 
My problem is adding it and then if they order more than 2 (which wouldn't then fit into a flat rate box anymore), and if they pick that option, I have a problem. 

I have my doubt whether this can be used in the module but, just hoping that (maybe) someone has figured out a way to do it. 

 

Share this post


Link to post
Share on other sites

I seem to be getting a specific error with any address from Denmark:

 

 

Warning: Invalid argument supplied for foreach() in /***/***/***/catalog/includes/modules/shipping/usps.php on line 123

 

Everything seems fine otherwise.  I have tried addresses for Australia, Taiwan, UK, Canada, etc. and everything works just fine.  However, I get the message above on the shipping page in checkout with whatever I put in for Denmark, apparently.  Proceeding further in checkout bombs out completely with the following:

 

Warning: Invalid argument supplied for foreach() in /***/***/***/catalog/includes/modules/shipping/usps.php on line 123

Warning: Cannot modify header information - headers already sent by (output started at /***/***/***/catalog/includes/modules/shipping/usps.php:123) in /***/***/***/catalog/includes/functions/general.php on line 49

 

 

Is there some error with the database in using Denmark?

 

P.S. I have UPS and FedEx shipping options running at the same time, too - with no errors.

 

P.P.S.  This seems to be locking up on the usps.com website as well.  It will "Calculate a Price" OK, but then if you select, "Print Postage" it locks up completely and comes back with a "Session Timeout" message.

Edited by TomB01

Share this post


Link to post
Share on other sites

I believe that the USPS module gets its data from the same server that the USPS website uses. If their website is not responding and the osC module is not responding, there is probably a common cause. You can wait for them to fix the problem, or you can set up a table rate and zone it for Denmark until the USPS gets their act together.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Got another one:

 

This is failing for a customer address in the Netherlands:

 

Warning: Invalid argument supplied for foreach() in /home1/xxxx/public_html/catalog/includes/modules/shipping/usps.php on line 123

Warning: Cannot modify header information - headers already sent by (output started at /home1/xxxx/public_html/catalog/includes/modules/shipping/usps.php:123) in /home1/xxxx/public_html/catalog/includes/functions/general.php on line 49

 

Attempts on usps.com seem to work with the customer's address.  Also, test addresses from Australia, Taiwan, etc., have no issue.

Edited by TomB01

Share this post


Link to post
Share on other sites

Line 123 in the latest release of this Addon is not a foreach(), so the first step would b e to install USPS Rate V4 Intl Rate V2 r3.6 and try again. If you still see the same error, post about 10 lines of code around the error line so we can take a look at it.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Thanks for all of your effort in keeping this up-to-date, Jim. I will upload the new version as soon as I can and report back.

Share this post


Link to post
Share on other sites

Line 123 in the latest release of this Addon is not a foreach(), so the first step would b e to install USPS Rate V4 Intl Rate V2 r3.6 and try again. If you still see the same error, post about 10 lines of code around the error line so we can take a look at it.

 

Regards

Jim

 

Upgraded to V2_r3.6

Same error, with a slight change in line numbers (line number 123 changed to line number 124):

 

 

Warning: Invalid argument supplied for foreach() in /home1/****/public_html/catalog/includes/modules/shipping/usps.php on line 124

 

Warning: Cannot modify header information - headers already sent by (output started at /home1/tomb/public_html/catalog/includes/modules/shipping/usps.php:124) in /home1/****/public_html/catalog/includes/functions/general.php on line 49

The error message above is at the top of a blank screen after clicking "Continue" from the checkout page.

 

It also generates this on the checkout at the top of the page, but displays the rest of the page with all shipping options and pricing correctly:

 

Warning: Invalid argument supplied for foreach() in /home1/****/public_html/catalog/includes/modules/shipping/usps.php on line 124

 

 

Here's the usps.php file with lines of code before and after as requested:

 

      for ($i = 0; $i < $PackageSize; $i++) {

        $Services = array ();

        $shownServices = array ();

        $hiddenServices = array ();

        $customerServices = array ();

        $hiddenCost = 0;

        $shownCost = 0;

        $shownString = '';

        $customerString = '';

        $handling = 0;

        $types = explode(', ', MODULE_SHIPPING_USPS_TYPES);

        if (isset ($uspsQuote['Package'][$i]['Error']) && tep_not_null($uspsQuote['Package'][$i]['Error']))

          continue;

        $Package = ($PackageSize == 1 ? $uspsQuote['Package']['Postage'] : ($order->delivery['country']['iso_code_2'] == 'US' ? $uspsQuote['Package'][$i]['Postage'] : $uspsQuote['Package']['Service'][$i]));

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

          if (tep_not_null($Package['SpecialServices']['SpecialService']))

            foreach ($Package['SpecialServices']['SpecialService'] as $key => $val)

              if (isset ($dExtras[$val['ServiceName']]) && tep_not_null($dExtras[$val['ServiceName']]) && ((MODULE_SHIPPING_USPS_RATE_TYPE == 'Online' && $val['AvailableOnline'] == 'true') || (MODULE_SHIPPING_USPS_RATE_TYPE == 'Retail' && $val['Available'] == 'true'))) {

                $val['ServiceAdmin'] = $dExtras[$val['ServiceName']];

                $Services[] = $val;

              }

          $cost = MODULE_SHIPPING_USPS_RATE_TYPE == 'Online' && tep_not_null($Package['CommercialRate']) ? $Package['CommercialRate'] : $Package['Rate'];

          $type = $Package['MailService'];

        } else {

          foreach ($Package['ExtraServices']['ExtraService'] as $key => $val) {     <-- THIS IS LINE 124

            if ( is_array ( $val ) &&

                 array_key_exists ( 'ServiceName', $val ) &&

                 isset ( $iExtras[$val['ServiceName']] ) &&

                 tep_not_null($iExtras[$val['ServiceName']]) &&

                 ((MODULE_SHIPPING_USPS_RATE_TYPE == 'Online' &&

                     $val['AvailableOnline'] == 'True') ||

                   (MODULE_SHIPPING_USPS_RATE_TYPE == 'Retail' &&

                     $val['Available'] == 'True'))) {

              $val['ServiceAdmin'] = $iExtras[$val['ServiceName']];

              $Services[] = $val;

            }

          }

          $cost = MODULE_SHIPPING_USPS_RATE_TYPE == 'Online' && tep_not_null($Package['CommercialPostage']) ? $Package['CommercialPostage'] : $Package['Postage'];

          $type = $Package['SvcDescription'];

        }

        

        if ($cost == 0) {

          continue;

        }

          

        foreach ($types as $key => $val) {

          if (!is_numeric($val) && $val == $type) {

            $minweight = $types[$key +1];

            $maxweight = $types[$key +2];

            $handling = $types[$key +3];

          }

        }

 

 

Again, this is an intermittent issue, depending on the country address.  I have test addresses for Taiwan, Canada, and Australia - no problem.  Then the one from the Netherlands fails and so does one from the UK.

Share this post


Link to post
Share on other sites

It appears that no checking is done to see if the array exists. Try adding this just before line 124:

          if (tep_not_null($Package['ExtraServices']['ExtraService']))

Regards

Jim


See my profile for a list of my addons and ways to get support.

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

×