Zen Cart Logo
Forums / General Questions / USPS shipping module has rendered checkout inoperable

USPS shipping module has rendered checkout inoperable

Views: 2,320

Results 1 to 5 of 5
14 Feb 2023, 4:26 AM
#1
dalecooper avatar

dalecooper

New Zenner

Join Date:
Nov 2014
Location:
Athens, GA
Posts:
25
Plugin Contributions:
0

USPS shipping module has rendered checkout inoperable

URL: https://unspeakableaxerecords.com
ZC: 1.5.7
PHP: 7.4.33

Having a new, crippling issue. I am not sure how or if this relates to the one I was having this morning (see thread: https://www.zen-cart.com/showthread.php?229300-Error-when-trying-to-add-products-to-cart )

Directly relevant history: this evening, a customer reported to me that he was unable to check out, and when he tried to continue on from step 1 to step 2, it just kicked him back to step 1. I noticed from a screenshot that there were no displayed shipping options. I have had the USPS module installed for a long time, and normally, any customer would be presented with one to three services (media mail, priority mail, and first class; first class automatically disables above a certain package weight, and I had some customized code in usps.php to disable media mail for packages including apparel items). This buyer should have been seeing priority mail only for what he was ordering, but was seeing nothing.

I logged into my admin area and looked at the USPS settings. Priority mail was enabled, but it wasn't showing up for him or for me when I did a checkout test. Thinking it might resolve the issue, I downloaded and installed the newest USPS. Per the readme in the zip file, I should have only needed to upload three new files, and my old settings would be retained. I found that they were in fact retained, but some settings looked to be in the wrong place suddenly (e.g. service descriptions were in fields for maximum weight), so I went through all settings and corrected them manually.

Following these updates, a test checkout showed the two or three services I wanted to see, depending on the order weight. So far, so good. The last thing I wanted to do was update usps.php again to disable media mail service for packages containing apparel. I had saved some instructions for exactly what to edit in that file, and did so as has worked for me in the past.

As soon as I made this change and uploaded the revised file, the checkout process broke. Clicking on checkout would just result in a completely blank page. Also, clicking on the shipping estimator shows no estimates.

Rather than trying to undo my php changes, I re-uploaded the files from the .zip, restoring them to their initial state (or at least intending to do so). That didn't fix it. I then tried removing the module in my admin area, and reinstalling it, inputting all the settings manually again. This also didn't fix it. Since then I have been combing through logs that I don't really understand for an hour, trying to figure out what exactly is going on. I don't really get how this got so irreversibly broken. If USPS is turned on, checkout simply doesn't work--no amount of restoring the USPS-related php files or removing/reinstalling the module or playing with its settings has helped. If it is turned off, checkout starts working, but the default shipping options in ZenCart simply don't work for my business so that is only troubleshooting info, not a real workaround. I'm at a loss.

14 Feb 2023, 12:26 PM
#2
dalecooper avatar

dalecooper

New Zenner

Join Date:
Nov 2014
Location:
Athens, GA
Posts:
25
Plugin Contributions:
0

Re: USPS shipping module has rendered checkout inoperable

Back trying to figure this out this morning. Here is a sample log file that seems to show the checkout error; I have many exactly like this one.

[14-Feb-2023 05:22:26 America/Boise] PHP Fatal error:  Uncaught Error: Cannot access protected property usps::$quotes in /home3/unspeak4/public_html/purchase/includes/classes/shipping.php:191
Stack trace:
#0 /home3/unspeak4/public_html/purchase/includes/modules/pages/checkout_shipping/header_php.php(209): shipping->cheapest()
#1 /home3/unspeak4/public_html/purchase/index.php(35): require('/home3/unspeak4...')
#2 {main}
  thrown in /home3/unspeak4/public_html/purchase/includes/classes/shipping.php on line 191

[14-Feb-2023 05:22:26 America/Boise] Request URI: /purchase/index.php?main_page=checkout_shipping, IP address: 75.137.182.179
--> PHP Fatal error: Uncaught Error: Cannot access protected property usps::$quotes in /home3/unspeak4/public_html/purchase/includes/classes/shipping.php:191
Stack trace:
#0 /home3/unspeak4/public_html/purchase/includes/modules/pages/checkout_shipping/header_php.php(209): shipping->cheapest()
#1 /home3/unspeak4/public_html/purchase/index.php(35): require('/home3/unspeak4...')
#2 {main}
  thrown in /home3/unspeak4/public_html/purchase/includes/classes/shipping.php on line 191.
14 Feb 2023, 12:34 PM
#3
lat9 avatar

lat9

Administrator

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

Re: USPS shipping module has rendered checkout inoperable

Sigh. I've got that corrected on GitHub for K11h ... but forgot to release it!

14 Feb 2023, 12:53 PM
#4
dalecooper avatar

dalecooper

New Zenner

Join Date:
Nov 2014
Location:
Athens, GA
Posts:
25
Plugin Contributions:
0

Re: USPS shipping module has rendered checkout inoperable

So it's a known issue of sorts? Any idea how I can fix it now? I am puzzled what exactly has changed from the config that was working last night. All three files from the latest USPS zip have been restored to their unmodified state. I also copied over includes/classes/shipping.php from the ZC 1.5.7 install package, as I noticed it had been modified and was being called out in some of the logs. But at this point the only thing that prevents the blank page is just disabling USPS altogether.

14 Feb 2023, 1:01 PM
#5
lat9 avatar

lat9

Administrator

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

Re: USPS shipping module has rendered checkout inoperable

dalecooper:

So it's a known issue of sorts? Any idea how I can fix it now? I am puzzled what exactly has changed from the config that was working last night. All three files from the latest USPS zip have been restored to their unmodified state. I also copied over includes/classes/shipping.php from the ZC 1.5.7 install package, as I noticed it had been modified and was being called out in some of the logs. But at this point the only thing that prevents the blank page is just disabling USPS altogether.
Please continue any discussion in the USPS support thread: https://www.zen-cart.com/showthread.php?227284-USPS-Shipping-Module-Support-Thread

I've noted there that the K11h release is now available.