Jump to content

USPS issue with Priority Mail Small Flat Rate


paulmillard

Recommended Posts

I found that after upgrading from CubeCart 3 to 5.2.1 that we had a few severe issues with getting Priority Mail shipping rates since USPS changed some of their API.  In a nutshell, my customer's site, a registered CubeCart user, has only two shipping product, and one fits nicely in a Priority Mail Small Flat Rate Box, making shipping easy and inexpensive.  After the upgrade from 3 to 5.2.1 we noticed 2 things:

 

1. Customers in other countries couldn't make purchases

2. Once we figured out that we had to add each country to the USPS Shipping method, that they were not getting the lower rate for the Priority Mail Small Flat Rate boxes.  

 

I tracked this down and found that when using the international shipping in cubecart for Priority Mail, that it was only getting the Priority Mail Medium Flat Rate Box, although the items dimensions were small enough to fit in the Small, resulting as an example, shipping from Mid-US to Ontario Canada, the item was showing up as 40.95, when in the past we had paid less than $20.  This seemed like an outrageous price hike even for USPS.  So I dove into the code, and found that if I commented out the if stated around line 168 in shipping.class.php, that I could see all the prices including the one that my customer wants.

 

I did some digging, and with the USPS' incomplete API spec, I found that it was a missing configuration item for a Service ID of 16.  So I edited my Cubecart files and added the following to return this shipping option to the admin configuration and the results for shipping:

 

modules/shipping/USPS/skin/admin/index.tpl

line 192 I added in the comments section so I could see it for future ref:

 

     <!--
1 - Express Mail International
2 - Priority Mail International
4 - Global Express Guaranteed (Document and Non-document)
5 - Global Express Guaranteed Document used
6 - Global Express Guaranteed Non-Document Rectangular shape
7 - Global Express Guaranteed Non-Document Non-Rectangular
8 - Priority Mail Flat Rate Envelope
9 - Priority Mail Flat Rate Box
10 - Express Mail International Flat Rate Envelope
11 - Priority Mail Large Flat Rate Box
12 - Global Express Guaranteed Envelope
13 - First Class Mail International Letters
14 - First Class Mail International Flats
15 - First Class Mail International Parcels
16 - Priority Mail Small Flat Rate Box
21 - PostCards
    -->
 
then in the same file around line 294 added another entry for the admin tool:
<div>
<label style="width: 350px">{$LANG.usps.service_intl_priority_small}</label>
<span>
<input type="hidden" name="module[intl_class_id_16]" id="intl_class_id_16" class="toggle" value="{$MODULE.intl_class_id_16}" />
</span>
  </div>
 
 
After this I edited 
modules/shipping/USPS/module.definitions.xml
line 35 added a new ref so it would be parsed, etc:
 
  <string name="service_intl_priority_small"><![CDATA[Priority Mail International Small Flat Rate Box]]></string>
 
Now the option shows up so it can be configured and international customers can select that type of shipping option.
 
I found some others searching other sites, and used SoapUI for Mac to create some posts to get rates according to the USPS API and get back the return values and add them to the configuration.
 
I hope this helps someone else and will be included in future releases.
 
Thanks

 

Link to comment
Share on other sites

Also for Domestic:

 

 

<div>
<label style="width: 350px">{$LANG.usps.service_flat_box_priority_small}</label>
<span>
<input type="hidden" name="module[class_id_28]" id="class_id_28" class="toggle" value="{$MODULE.class_id_28}" />
</span>
</div>
 
 
And an item for the config:
 
  <string name="service_flat_box_priority_small"><![CDATA[Priority Mail Small Flat-rate Box]]></string>
Link to comment
Share on other sites

Guest smdstudios

maybe I missed something but I did the above mentioned for flat rate small and not getting the option to show up on the front end?

Link to comment
Share on other sites

Since you're having problems with this, and I don't use it myself to check, I've taken the Resolved designation off. Hopefully someone will be along soon who can help you. In the meantime, please create your signature, as it is very helpful to those who are able to assist.

Link to comment
Share on other sites

I apologize, I forgot to include the instructions once the files have been edited.  

 

Once the edits have been done, go back into the Shipping Methods, USPS and edit it.

 

If all has been done correctly, it should show up as an option to enable in International Services and Domestic Services.  For mine since I put the new div tags as the last option, they appear as the last for each services type.  Click on them to enable them and save.

 

From that point on, they should appear appropriately as a shipping option if the shipping configuration package size and the weight limit for the "Priority Mail Small Flat-rate Box"

 

I hope that helps



As a Comparison here is the basic snapshot of my store overview, with no other mods, skins or edits.:

 

 

Script Version 5.2.1 PHP Version 5.2.17 MySQL Version 50168 Image folder size 267.6 KB Download folder size 0 Bytes Max. Upload filesize 128M Browser user-agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.160 Safari/537.22 Server Software Apache  
Link to comment
Share on other sites

Thank you for sharing this! Please share this on the Bug Tracker so it will be added to the next version. If anyone happens to find unintended consequences of this fix PLEASE share your experience here.

Where is the Bug Tracker that you are referring to?  Thanks.

Link to comment
Share on other sites

Guest smdstudios

I'm pretty sure I activated it in the backend but I'll check here in a bit and confirm.

 

Just to make sure I read this right I'm editing 2 files on and since I only care about domestic I'm adding a couple lines of code in each files that you noted above.

Link to comment
Share on other sites

  • 5 months later...

Join the conversation

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

Guest
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...