Zen Cart Logo
Forums / Addon Shipping Modules / USPS Shipping Module [Support Thread]

USPS Shipping Module [Support Thread]

Sticky

Views: 77,349

Results 81 to 100 of 447
18 May 2021, 3:00 PM
#81
mikestaps avatar

mikestaps

Zen Follower

Join Date:
Aug 2010
Location:
Grand Blanc, MI
Posts:
305
Plugin Contributions:
1

USPS Shipping Module [Support Thread]

Nope... I wish there was.

I am running into a PayPal checkout error too, I wouldn't think that could be related as it's the "next" step, but maybe.

I'm getting a "10002 Security error - Security header is not valid". All settings in that module have been quadruple checked.

18 May 2021, 3:01 PM
#82
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,096
Plugin Contributions:
56

Re: USPS Shipping Module [Support Thread]

I'll note that in my use, I've got

Enable USPS First-Class filter for US shipping: True

18 May 2021, 3:12 PM
#83
mikestaps avatar

mikestaps

Zen Follower

Join Date:
Aug 2010
Location:
Grand Blanc, MI
Posts:
305
Plugin Contributions:
1

Re: USPS Shipping Module [Support Thread]

No change in results when switching the First-Class Filter to True.

18 May 2021, 3:24 PM
#84
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,096
Plugin Contributions:
56

Re: USPS Shipping Module [Support Thread]

Please take a screenshot of the editing of the USPS module settings (obfuscating your API key) and post. I'll attempt to recreate using the settings that you're using.

18 May 2021, 4:01 PM
#85
mikestaps avatar

mikestaps

Zen Follower

Join Date:
Aug 2010
Location:
Grand Blanc, MI
Posts:
305
Plugin Contributions:
1

Re: USPS Shipping Module [Support Thread]

Attachment 19574

Attachment 19575

Attachment 19576

18 May 2021, 5:01 PM
#86
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,096
Plugin Contributions:
56

Re: USPS Shipping Module [Support Thread]

@mikestaps, I don't get it. I've applied your settings (other than that "non-taxable" tax class) and am receiving quotes.

How is that Non-Taxable tax class defined? Why not just "not" identify a tax group?

Update: Is there any difference if you change the server from 'production' to 'test'?

18 May 2021, 5:17 PM
#87
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Re: USPS Shipping Module [Support Thread]

Lat9 - retail radio, USPS Tracking and display weight are selected. Rest of the switches are the same, values are close to mikestaps.

2021-05-18 12:11:00: USPS build: 2021-05-05 K11a

Server: test
Quote Request Rate Type: Retail
Quote from main_page: popup_shipping_estimator
USPS Options (weight, time): Display weight
USPS Domestic Transit Time Calculation Mode: NEW
Cart Weight: 0.175
Total Quote Weight: 0.3 Pounds: 0 Ounces: 5
Maximum: 25 Tare Rates: Small/Medium: 0:0.125 Large: 0:15
Handling method: Box Handling fee Domestic: $0.00 Handling fee International: $0.00
Decimals: 2
Domestic Length: 8.625 Width: 5.375 Height: 1.625
International Length: 8.625 Width: 5.375 Height: 1.625
All Packages are Machinable: False
Enable USPS First-Class filter for US shipping: True
Sorts the returned quotes: Price-LowToHigh

ZipOrigination: 89128
ZipDestination: Postcode: 89128 Country: United States City: Las Vegas State: Nevada
Order SubTotal: $20.50
Order Total: $20.50
Uninsurable Portion: $0.00
Insurable Value: $20.50

2021-05-18 12:11:00: Sending request to USPS

2021-05-18 12:11:00: ==================================

SENT TO USPS:

<RateV4Request USERID="Twitch removed"><Revision>2</Revision>
<Package ID="0"><Service>PRIORITY COMMERCIAL</Service><ZipOrigination>89128</ZipOrigination><ZipDestination>89128</ZipDestination><Pounds>0</Pounds><Ounces>5</Ounces><Container>LEGAL FLAT RATE ENVELOPE</Container><Size>REGULAR</Size><Value>20.50</Value><SpecialServices> <SpecialService>155</SpecialService>
</SpecialServices><Machinable>FALSE</Machinable></Package>
<Package ID="1"><Service>PRIORITY COMMERCIAL</Service><ZipOrigination>89128</ZipOrigination><ZipDestination>89128</ZipDestination><Pounds>0</Pounds><Ounces>5</Ounces><Container>MD FLAT RATE BOX</Container><Size>REGULAR</Size><Value>20.50</Value><SpecialServices> <SpecialService>155</SpecialService>
</SpecialServices><Machinable>FALSE</Machinable></Package>
<Package ID="2"><Service>PRIORITY COMMERCIAL</Service><ZipOrigination>89128</ZipOrigination><ZipDestination>89128</ZipDestination><Pounds>0</Pounds><Ounces>5</Ounces><Container>LG FLAT RATE BOX</Container><Size>REGULAR</Size><Value>20.50</Value><SpecialServices> <SpecialService>155</SpecialService>
</SpecialServices><Machinable>FALSE</Machinable></Package>
</RateV4Request>

RESPONSE FROM USPS:

==================================
CommErr (should be 0): 0 -

==================================

USPS Country - $order->delivery[country][iso_code_2]: United States $this->usps_countries: US
Domestic Services Selected:
USPS TrackingTM Electronic

2021-05-18 12:11:00: RESPONSE FROM USPS:

============

RAW XML FROM USPS:

  • end of log -
18 May 2021, 5:30 PM
#88
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Re: USPS Shipping Module [Support Thread]

No change in the **test **vs production switch on the live site either.

18 May 2021, 6:03 PM
#89
mikestaps avatar

mikestaps

Zen Follower

Join Date:
Aug 2010
Location:
Grand Blanc, MI
Posts:
305
Plugin Contributions:
1

Re: USPS Shipping Module [Support Thread]

No change from production to testing server wise, I have switched back and forth. Also no change by switching the Tax Class. I ran it using --none--, Taxable, and Non-Taxable.

The Non-taxable tax class is pre-set up. We have always used that for shipping, as it is a service vs. a product.

I'm really wondering if it is something to do with the the USERID on their end?

twitch, is your 1.5.5f still up and running? and USPS still working on it? That would rule out my USERID theory...

18 May 2021, 6:13 PM
#90
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Re: USPS Shipping Module [Support Thread]

mikestaps:

No change from production to testing server wise, I have switched back and forth. Also no change by switching the Tax Class. I ran it using --none--, Taxable, and Non-Taxable.

The Non-taxable tax class is pre-set up. We have always used that for shipping, as it is a service vs. a product.

I'm really wondering if it is something to do with the the USERID on their end?

twitch, is your 1.5.5f still up and running? and USPS still working on it? That would rule out my USERID theory...

**Yes **USPS is running properly on this server in the 1.55f production site.

I can make this happen on occasion in the 1.57c USPS test site but I haven't had a chance to trace it:

RAW XML FROM USPS:

SimpleXMLElement Object
(
[Number] => 80040B1A
[Description] => Authorization failure. Perhaps username and/or password is incorrect.
[Source] => USPSCOM::DoAuth
)

25 May 2021, 12:19 PM
#91
mikestaps avatar

mikestaps

Zen Follower

Join Date:
Aug 2010
Location:
Grand Blanc, MI
Posts:
305
Plugin Contributions:
1

Re: USPS Shipping Module [Support Thread]

Twitchtoo Have you made any progress with this?

Unfortunately I have not... I contacted USPS to see if it could be something going on with my account on their end of things, but after several phone calls and emails I am not getting any response from them.

30 May 2021, 12:49 PM
#92
helenewallis avatar

helenewallis

Totally Zenned

Join Date:
Jun 2016
Location:
Suffolk VA
Posts:
625
Plugin Contributions:
0

Re: USPS Shipping Module [Support Thread]

I've installed the new USPS shipping module and I'm getting the error "Nothing has been selected for quotes." I'm dead in the water on a busy weekend until this is fixed. I've looked at all the things you can edit for the module and don't see anything that hasn't been set the same way as it was before, as directed in the installation instructions. What am I doing wrong?

I did track down where the error message is coming from--"Will auto-disable the shipping method if either no services // have been selected or the country-of-origin is not the US." Neither of those conditions is true.

30 May 2021, 12:50 PM
#93
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,096
Plugin Contributions:
56

Re: USPS Shipping Module [Support Thread]

HeleneWallis:

I've installed the new USPS shipping module and I'm getting the error "Nothing has been selected for quotes." I'm dead in the water on a busy weekend until this is fixed. I've looked at all the things you can edit for the module and don't see anything that hasn't been set the same way as it was before, as directed in the installation instructions. What am I doing wrong?
A screenshot of your USPS settings would help. What version of Zen Cart is in use?

30 May 2021, 12:59 PM
#94
helenewallis avatar

helenewallis

Totally Zenned

Join Date:
Jun 2016
Location:
Suffolk VA
Posts:
625
Plugin Contributions:
0

Re: USPS Shipping Module [Support Thread]

Never mind, I realized that none of the boxes for the shipping rates were checked. Problem fixed.

30 May 2021, 9:13 PM
#95
tedjmaines avatar

tedjmaines

New Zenner

Join Date:
Mar 2021
Location:
Campbell, Texas USA
Posts:
13
Plugin Contributions:
0

Re: USPS Shipping Module [Support Thread]

tedjmaines:

I have never got it working. in previous edition v154 and beyond, we did flat rate. I would like to get this working. I read the other versions post but it does not work for v157c with K11. If someone got it to work in previous versions of USPS maybe they can let you know. The code I read before used a master category number for Media (mine is Master_id = 5) for loop but that did not work on my K11.

Still have this issue with new K11a on v157c. I put the proper category for books which is shipped Media Parcel Mail in code as instructed. What it is suppose to do is if anything is NOT a book is put in cart then Media Mail option should not be shown, but on my site Media Mail option is always shown. Anyone have a thought on why??? Thanks.

30 May 2021, 10:07 PM
#96
helenewallis avatar

helenewallis

Totally Zenned

Join Date:
Jun 2016
Location:
Suffolk VA
Posts:
625
Plugin Contributions:
0

Re: USPS Shipping Module [Support Thread]

tedjmaines:

Still have this issue with new K11a on v157c. I put the proper category for books which is shipped Media Parcel Mail in code as instructed. What it is suppose to do is if anything is NOT a book is put in cart then Media Mail option should not be shown, but on my site Media Mail option is always shown. Anyone have a thought on why??? Thanks.

I had a similar situation. Ajeh (Linda) provided me with a starter routine to permit the exclusion of a class or classes of shipping types depending on the shopping cart contents. To my amazement, that starter code is now in the new version of usps.php, and available for anyone to play with.

With whatever editor program you're using, do a search for " // *** Customizations once per display ***"

The lines after that are as follows:

    // bof: example to block USPS Priority MailTM Small Flat Rate Box when anything from master_categories_id 12 or 15 are in the cart
    // change false to true to use
    if (false) {
        $chk_cart = 0;
        $chk_cart += $_SESSION['cart']->in_cart_check('master_categories_id','12');
        $chk_cart += $_SESSION['cart']->in_cart_check('master_categories_id','15');
    }
    // see below use of $chk_cart
    // eof: example to block USPS Priority MailTM Small Flat Rate Box when anything from master_categories_id 12 or 15 are in the cart

This was my initial attempt to keep certain things from being shipped in a small flat rate box, and $master_categories_id shown here was the first two categories that I needed to exclude from small flat rate shipping . I have since expanded on this to exclude a wide variety of shipping types, depending on the category or the product or the quantity being ordered. If you want to try this, simply substitute your category number for books for the '12' shown in the example above. You'll need to comment out the next statement if you don't want your category '15' to be similarly affected. And it would be a good idea to substitute the shipping type you're excluding (Media) in the comments, in place of the 'USPS Priority MailTM Small Flat Rate box' verbage. Otherwise, someone (possibly you) is going to be really confused at some point in the future when you need to edit this section or figure out why something isn't working.

There is one more place where you need to insert a few lines. Search for "$type_rebuilt = $type;"

The first few lines after that should read:

// bof: example to block USPS Priority MailTM Small Flat Rate Box when anything from specific master_categories_id are in the cart
// see above for $chk_cart settings
// change false to true to use WAS FALSE
if (true) {
if ($chk_cart > 0 && $type == 'Priority MailTM Small Flat Rate Box') {
// echo 'USPS $type: ' . $type . ' $chk_cart:' . $chk_cart . ', line 575 <br>';
continue;
}
}
// eof: example to block USPS Priority MailTM Small Flat Rate Box when anything from master_categories_id 12 or 15 are in the cart

You'll need to substitute 'MEDIA' where the line above says 'Priority MailTM Small Flat Rate Box.' And you might want to change the wording of the comments so it's refers to Media Mail rather than the Small Flat Rate Box in the code.

The first section of code checks the category number of the items in the cart. If any of them is in a category that could not be shipped by the specified shipping type, then it increments the variable $chk_cart. The second section of code tests $chk_cart to see whether it is greater than zero AND if the shipping type variable ($type) is exactly equal to the value in the quotes. If so, that shipping type will be excluded from the list of shipping types that the customer can choose from.

If you're comfortable tweaking the code, you can expand on this the same way I did, to check for multiple different product or category numbers, for the quantities of certain items, and for whatever else you need to exclude from certain shipping types. Over the years, I've added enough checks that it's very seldom a customer can specify a shipping type unsuitable for the product(s) in the cart. Every test you add will slow down execution just a little bit, of course, so it you have an extremely varied inventory, this may not work well for you. But it has been ideal for us, with a fairly small number of broad categories.

30 May 2021, 11:47 PM
#97
tedjmaines avatar

tedjmaines

New Zenner

Join Date:
Mar 2021
Location:
Campbell, Texas USA
Posts:
13
Plugin Contributions:
0

Re: USPS Shipping Module [Support Thread]

HeleneWallis:

The first section of code checks the category number of the items in the cart. If any of them is in a category that could not be shipped by the specified shipping type, then it increments the variable $chk_cart. The second section of code tests $chk_cart to see whether it is greater than zero AND if the shipping type variable ($type) is exactly equal to the value in the quotes. If so, that shipping type will be excluded from the list of shipping types that the customer can choose from.

Thank you Helene. I did modifications as you suggested and it works the reverse that I need. I need only master category 15 (books) to use Media Mail. What I have is category 15 (books) excludes the Media Mail and all other non-books show media mail. So my logic is backwards. I tried changing true and false but does not seem to work. Must have made a logic error.

31 May 2021, 12:15 PM
#98
helenewallis avatar

helenewallis

Totally Zenned

Join Date:
Jun 2016
Location:
Suffolk VA
Posts:
625
Plugin Contributions:
0

Re: USPS Shipping Module [Support Thread]

tedjmaines:

Thank you Helene. I did modifications as you suggested and it works the reverse that I need. I need only master category 15 (books) to use Media Mail. What I have is category 15 (books) excludes the Media Mail and all other non-books show media mail. So my logic is backwards. I tried changing true and false but does not seem to work. Must have made a logic error.

I see that I phrased something backwards. What you need to do is not substitute your category number for books, but to add all the category numbers except the one for books. Changing true to false will just prevent the code from being executed at all.

For example, this shows two categories excluded from Small Flat Rate box shipping. That was my original requirement. Now I have four categories excluded, plus a couple of product numbers that are in permitted categories but are still not appropriate to ship in a Small Flat Rate box. I also have exclusions in otherwise permissible categories based on the quantity of items ordered (two would be okay in a Small Flat Rate box, three would not be okay, for example).

If you have a very large number of categories, so many that adding a conditional statement for every one of them except books wouldn't be feasible, you might want to look at reorganizing your categories so you have broader ones that include more kinds of products. For example, I had one category that included all the products from a particular vendor. Then he started producing a product that fell more logically into another category I already had set up. Except that it required me to add many more conditional statements to keep that new product from being shipped in certain size boxes, even though everything else in that category could be shipped in those boxes. I eventually moved the new product to the category that included all the others from that vendor, and was able to simplify the shipping code considerably.

31 May 2021, 12:22 PM
#99
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,096
Plugin Contributions:
56

Re: USPS Shipping Module [Support Thread]

If you're using USPS K11a, then including a modified version of the autoloaded observer example (present in the zip-files /extras sub-directory) should disable media-mail unless all products in the cart are from category 15:

            case 'NOTIFY_USPS_UPDATE_OR_DISALLOW_TYPE':
                // -----
                // Disallow "Media Mail" unless all products in the cart have their master_categories_id within category 15.
                //
                if (stripos($p1, 'Media Mail') !== false) {
                    $chk_media = 0;

                    $chk_media += $_SESSION['cart']->in_cart_check('master_categories_id', '15');
                    if ($chk_media == $_SESSION['cart']->count_contents()) {
                        $p2 = false;
                    }
                }
                break;

If that books category contains sub-categories, you'll need to add additional lines to check for the presence of each of the sub-categories.

31 May 2021, 1:55 PM
#100
helenewallis avatar

helenewallis

Totally Zenned

Join Date:
Jun 2016
Location:
Suffolk VA
Posts:
625
Plugin Contributions:
0

Re: USPS Shipping Module [Support Thread]

lat9:

If you're using USPS K11a, then including a modified version of the autoloaded observer example (present in the zip-files /extras sub-directory) should disable media-mail unless all products in the cart are from category 15:

        case 'NOTIFY_USPS_UPDATE_OR_DISALLOW_TYPE':
            // -----
            // Disallow "Media Mail" unless all products in the cart have their master_categories_id within category 15.
            //
            if (stripos($p1, 'Media Mail') !== false) {
                $chk_media = 0;

                $chk_media += $_SESSION['cart']->in_cart_check('master_categories_id', '15');
                if ($chk_media == $_SESSION['cart']->count_contents()) {
                    $p2 = false;
                }
            }
            break;
> If that books category contains sub-categories, you'll need to add additional lines to check for the presence of each of the sub-categories.

Thanks, I can use that too.