Jump to content

USPS API problems? or just me?


djcaseanova
 Share

Recommended Posts

  • 2 weeks later...

Guest ilsesthings

I was wondering if to use Alan T's mod and the usps option, do I have to enter also the Shipping by Weight information?? It seems to me yes, but just not sure how to make the 2 colaborate or if they do it automatically.

Sorry if this is an assinine question! :)

Thanks!!

ilse

www.ilsesthings.com

Link to comment
Share on other sites

Guest ilsesthings

And it works for 3.0.10 no problem.

ST

well, i have the same version, but not the second file I must comment-out!! Any ideas??

Thanks again!

i.

Link to comment
Share on other sites

  • 3 weeks later...
Guest steveboy

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!

I have the same problem -- too many options instead of one unsatisfactory one. I only want to ship Global Priority and Domestic Priority, but every effort I have made to get rid of the other options has either made no difference or resulted in error codes. I'm hoping it's a simple fix!

Link to comment
Share on other sites

  • 3 months later...
Guest rock_lee225

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.

Hey i opened my index from

/admin/modules/shipping/USPS/index.php

but all i see is the stuff below. Where is the stuff that i'm supposed to edit? am i doing something wrong? I can do the other parts you specified in class.php, but this is all i see when i open the index.

<?php

/*

+--------------------------------------------------------------------------

| CubeCart v3.0.14

| ========================================

| by Alistair Brookbanks

| CubeCart is a Trade Mark of Devellion Limited

| Copyright Devellion Limited 2005 - 2006. All rights reserved.

| Devellion Limited,

| 22 Thomas Heskin Court,

| Station Road,

| Bishops Stortford,

| HERTFORDSHIRE.

| CM23 3EE

| UNITED KINGDOM

| http://www.devellion.com

| UK Private Limited Company No. 5323904

| ========================================

| Web: http://www.cubecart.com

| Date: Wednesday, 1st November 2006

| Email: sales (at) cubecart (dot) com

| License Type: CubeCart is NOT Open Source Software and Limitations Apply

| Licence Info: http://www.cubecart.com/site/faq/license.php

+--------------------------------------------------------------------------

| index.php

| ========================================

| Include Modules List

+--------------------------------------------------------------------------

*/

$module = "shipping";

include("../index.php");

?>

Link to comment
Share on other sites

Guest rock_lee225

That's not the right index.php file, but the one in the folder above (ie- in the /admin/modules/shipping/ folder).

You need to go down one more into the usps folder.

I"m looking in the shipping folder but i don't see an index at all, in teh shipping or usps folder.

nvm i think i see it now. thanks

Link to comment
Share on other sites

  • 1 month later...

Want to add a quick reply in this for those that may run into the same problem as I.

CubeCart 3.0.15

I have products that are too big for Express Mail Flat Rate Envelope, but that was the only available selection in the USPS API.

In admin/modules/shipping/usps/index.php under this line of code (around line 267):

<option value="Flat Rate Envelope" <?php if($module['expressContainer']=="Flat Rate Envelope") echo "selected='selected'"; ?>>Flat Rate Envelope</option>



I added:


<option value="Variable Rate" <?php if($module['expressContainer']=="Variable") echo "selected='selected'"; ?>>Variable Rate</option>

Save/Upload.

In the Admin Control Panel for USPS, I selected the drop-down for Flat Rate Envelope and selected the newly created 'Variable Rate' as the default.

Now, the small/light items are still the flat rate price, but anything bigger than those items show up the correct shipping.

On some quick tests, it looks to be working fine. If anyone has a better idea... please feel free to let me know. ;)

I had to fix this because I had a customer select Express Mail Flat Rate Envelope because it was the only option... and the difference in shipping was $12. I wasn't about to eat that for a product that costs $30.

--KC

Link to comment
Share on other sites

  • 1 year 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...