Jump to content

USPS API problems? or just me?


djcaseanova
 Share

Recommended Posts

Okay, when I sell something I give the option of first class and priority mail. But if the weight is larger than the limit for first class mail, will it automatically discard that option?

Priority mail is there and setup, but is there a way to get it to change the type of medium? For instance it's saying Flat Rate Envelope 12.5" x 9.5" and the items will NOT fit in that envelope.

I have different size products and that seems to be the only one coming up, even though they won't fit. Does this change based on weight or is this setup through the product somehow??? Anyone???

Link to comment
Share on other sites

Guest tbladecki

there is a way to get rid of the shipping container,..... let me see if I can find it... in the mean time do a search for "shipping container" and see if that helps, I used it and it works great.

Link to comment
Share on other sites

I have been doing a search for such a monster with no luck.

Also, is there a way to make it adjust to a different price instead of the "flat rate" for priority mail? I mean i've only seen 1 or 2 different prices for these items. But I wasn't sure if the options automatically changed based on weight?

Link to comment
Share on other sites

Guest tbladecki

I could not find the post that had the info but here are the changes to make to get rid of the shipping container in the USPS module

Open the shipping/USPS/calc.php file

find this section

case "Express":

	$package = array(



with this area there are "cases" for each of the shipping methods, find the case that you are wanting to get rid of the container restriction on... for example teh "Express" case is the first on listed, under each of the cases you will see a line that is similar to this:




'container' => $module['expressContainer'],



change them the following:


/*

Taken out the remove the restriction on package size

'container' => $module['expressContainer'],

*/

comment out this line and your problem whould go away, hence now the shipping will only see that the pacakge is 5lbs and will not give you a "flat Rate" quote.

I hope this helps you out, let me know if you have any problems.

Link to comment
Share on other sites

  • 2 weeks later...

This worked for the very short period of time before having to upgrade to 3.0.8

I had 3.0.8 fully installed and operational. I tried this again and now it won't add the packages anymore. Did something change in the updated version?? Just curious.. When I put it back to it's original state, it works fine.

Link to comment
Share on other sites

Guest rainman7715

yep, says "failed to add package."

Fixed problem!!!

Search for the following in /modules/shipping/USPS/class.usps.php

			//Check container for Express and Priority



and comment out the following lines


			//Check container for Express and Priority

//			if(strtolower($attribs['service']) == 'express' || strtolower($attribs['service']) == 'priority')

//			{

//				if(!isset($attribs['container'])) {  $this->debug("USPS ERROR: Container for express or priority post was not set."); return false; }

//				else {

//					switch(strtolower($attribs['container']))

//					{

//						case 'flat rate envelope':

//						case 'flat rate box':

//							break;

//						default:

//							$this->debug("USPS ERROR: Container not recognised.");

//							return false;

//					}

//				}

//			}

Hope this helps,

Seann

Link to comment
Share on other sites

Guest flightoffancy

I just tried this and now it will add the package but it doesn't calculate correctly. No matter what the weight is it gives the minimum cost for Priority .... $4.05.

yep, says "failed to add package."

Fixed problem!!!

Search for the following in /modules/shipping/USPS/class.usps.php

			//Check container for Express and Priority



and comment out the following lines


			//Check container for Express and Priority

//			if(strtolower($attribs['service']) == 'express' || strtolower($attribs['service']) == 'priority')

//			{

//				if(!isset($attribs['container'])) {  $this->debug("USPS ERROR: Container for express or priority post was not set."); return false; }

//				else {

//					switch(strtolower($attribs['container']))

//					{

//						case 'flat rate envelope':

//						case 'flat rate box':

//							break;

//						default:

//							$this->debug("USPS ERROR: Container not recognised.");

//							return false;

//					}

//				}

//			}

Hope this helps,

Seann

Link to comment
Share on other sites

  • 3 weeks later...
Guest tbladecki

That would be because the min charge for Priority is $4.05 correct?? Or ta least as far as I have even known.

Anyway here is the complete fix for this:

The files listed below are in shipping/USPS folder

In the class.usps.php you have to comment ou the following section:

/*

Taken out to remove restriction on package size



			//Check container for Express and Priority

			if(strtolower($attribs['service']) == 'express' || strtolower($attribs['service']) == 'priority')

			{

				if(!isset($attribs['container'])) {  $this->debug("USPS ERROR: Container for express or priority post 			

				was not set."); return false; }

				else {

					switch(strtolower($attribs['container']))

					{

						case 'flat rate envelope':

						case 'flat rate box':

							break;

						default:

							$this->debug("USPS ERROR: Container not recognised.");

							return false;

					}

				}

			}



*/

			//Check size





Then open the calc.php



find this section 


case "Express":

	$package = array(





with this area there are "cases" for each of the shipping methods, find the case that you are wanting to get rid of the container restriction on... for example teh "Express" case is the first on listed, under each of the cases you will see a line that is similar to this:




'container' => $module['expressContainer'],



change them the following:


/*

Taken out the remove the restriction on package size

'container' => $module['expressContainer'],

*/

comment out this line and your problem whould go away, hence now the shipping will only see that the pacakge is 5lbs and will not give you a "flat Rate" quote.

Link to comment
Share on other sites

  • 3 weeks later...
Guest shaywood

I think the MOD worked, but when displaying the shipping cost, the title is still the same - USPS Priority Mail Flat Rate box 11.25"x8.85"x6", etc. How do I change the title?

shawn

Link to comment
Share on other sites

  • 4 weeks later...
Guest loren antolik

if the rates are showing up like that then you didn't apply the mod correctly. the mod removes the container size so that all usps receives is the weight and the fact that you want priority or express. when the mod is working the value for priority and express will be

(USPS Priority Mail) $amount

(USPS Express Mail PO to Addressee) $amount

and the $amount will fluctuate depending upon the weight of your cart.

I think the MOD worked, but when displaying the shipping cost, the title is still the same - USPS Priority Mail Flat Rate box 11.25"x8.85"x6", etc. How do I change the title?

shawn

Link to comment
Share on other sites

Here is another way to accomplish the same thing, but leaving the option to switch to Flat Rate in the future.

First off, there is no need to edit calc.php with this method, as we are adding a new option to the USPS configuration.

To do this, open /admin/modules/shipping/USPS/index.php

Find:

<td valign="top"  class="tdText"><select name="module[priorityContainer]">



Right after that, add  
<option value="Variable" <?php if($module['priorityContainer']=="Variable") echo "selected='selected'"; ?>>Variable Rate</option>



Save and upload.



Next, open /modules/shipping/USPS/class.usps.php



Find:  
	//Check container for Express and Priority

			if(strtolower($attribs['service']) == 'express' || strtolower($attribs['service']) == 'priority')

			{

				if(!isset($attribs['container'])) {  $this->debug("USPS ERROR: Container for express or priority post was not set."); return false; }

				else {

					switch(strtolower($attribs['container']))

					{

						case 'flat rate envelope':

						case 'flat rate box':

							break;

						default:

							$this->debug("USPS ERROR: Container not recognised.");

							return false;

					}

				}

			}
 and comment it out, as in:




/*			//Check container for Express and Priority

			if(strtolower($attribs['service']) == 'express' || strtolower($attribs['service']) == 'priority')

			{

				if(!isset($attribs['container'])) {  $this->debug("USPS ERROR: Container for express or priority post was not set."); return false; }

				else {

					switch(strtolower($attribs['container']))

					{

						case 'flat rate envelope':

						case 'flat rate box':

							break;

						default:

							$this->debug("USPS ERROR: Container not recognised.");

							return false;

					}

				}

			}

 */



Next, find 
if(strtolower($attribs['service']) == 'express' || strtolower($attribs['service']) == 'priority') {
 and replace it with




if((strtolower($attribs['service']) == 'express' || strtolower($attribs['service']) == 'priority') AND (strtolower($attribs['container']) == 'flat rate envelope' || strtolower($attribs['container']) == 'flat rate box')) {

Save and upload.

Now, you can select in the admin screen whether to use Flat Rate or Variable Rate.

For some reason, my X-Cart installation is able to get a rate for a container of 0-1095, but CubeCart gets an error message from the USPS site when trying it. Seems like the USPS site is phasing out the option to use other types of containers for these services.

Link to comment
Share on other sites

  • 2 months later...
Guest Duckie

Thank You AlanT!!

this option is very important to USPS shipping and SHould become part of the distro.

a vast majority of mail is sent using priority mail calculated by weight, not just flate rate

I needed this option :D

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...
Guest rebeccalea

I did Alan T's fix and got my USPS rates in order.

Then I followed the tutorial for PayPal IPN and got that in order.

BUT

my "test customer" went through my cart and picked my one item set up for the test process. The shipping options were there in the cart - but when she checked out with PayPal "standard" the shipping charges disappeared.

Now what do you think? Is this a shipping data problem or a gateway problem? OR both?

thanks in advance...

rl

Link to comment
Share on other sites

Guest the grump

Does anyone know if these fixes will work for release 3.0.12? On my site the parcel post rate is calculated correctly according to weight. However, the priority mail rate displays "$8.10 11.25"x8.85"x6" no matter the size of the order. Any tips anyone can offer would be much appreciated.

Link to comment
Share on other sites

  • 2 weeks later...
Guest Kristina

Does anyone know if these fixes will work for release 3.0.12? On my site the parcel post rate is calculated correctly according to weight. However, the priority mail rate displays "$8.10 11.25"x8.85"x6" no matter the size of the order. Any tips anyone can offer would be much appreciated.

They will work with 3.0.12!

Kristina

Link to comment
Share on other sites

Has anyone come up with a USPS mod that will do the same thing for international shipping? This works great for domestic Priority Mail by weight, but when I have a customer outside the US, they are presented with 10 shipping options, including "flat-rate envelope", which shouldn't even be an option. I'm pretty sure the only option I want available is "USPS Global Priority Mail - Variable Weight (Single)". Thanks in advance!

Link to comment
Share on other sites

  • 3 weeks 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.

 Share

×
×
  • Create New...