Zen Cart Logo
Forums / Addon Shipping Modules / USPS Shipping (RESTful) (USPSr)

USPS Shipping (RESTful) (USPSr)

Sticky

Views: 54,871

Results 61 to 80 of 558
7 Mar 2025, 8:48 PM
#61
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

USPS Shipping (RESTful) (USPSr)

swguy:

Just downloaded 1.1.1. I think you still have an indexing issue. It still always shows the first method (Priority Mail) as the selected one on the second page of checkout.

Also you might want to think about how you handle the checkout pages after initial selection. You'll notice the other shipping modules use the signature

function quote($method = '')

where the selected method is passed in after the first call.

Okay I think that explains dbltoe's error log earlier. Will look into this one.

7 Mar 2025, 9:23 PM
#62
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,712
Plugin Contributions:
56

Re: USPS Shipping (RESTful) (USPSr)

It might also make sense to review how the old USPS module handles this.

I get that this is a bunch of work. Thanks for helping the project by tackling it.

8 Mar 2025, 1:00 AM
#63
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: USPS Shipping (RESTful) (USPSr)

swguy:

It might also make sense to review how the old USPS module handles this.

I get that this is a bunch of work. Thanks for helping the project by tackling it.

Yup that actually put me on to the right path. Pretty much I just ended up checking to see what the value of $method was and, if set/not empty, only added that to $quotes array. Before this, the entire list was sent to checkout_confirmation and ZenCart only put the first item from the array.

Nonetheless, I have pulled it off. I managed to get ZenCart to play nice with standard and OPC checkout. I still have to look into an odd issue with the date of delivery and days count being plastered twice. (I cannot replicate this, but am looking out for it. If you encounter this, please tell me what options you used (shipping methods, etc.) right away so I can try to replicate it.)

Combined v1.1.1 + v1.1.2 Notes (to the admins of the modules directory, please delete 1.1.1 if it hasn't been published... it's redundant at this point)

What's changed?

Fixed


  • (v1.1.1) Resolved all issues with regards to the selection of shipping methods during checkout. (Issues #28, #29, #30, #31) (Long and short run, there was a problem with the counting of each module presented and it caused issues.)
  • (v1.1.1) Fixed an issue that came up when trying to squash options but you were also using estimated dates/times (the squashing was ignored and all options were presented anyway, bad regex matching). (Issue #32)
  • (v1.1.2) Resolved issue that users had with selecting a shipping method and having it "stick". (There was an unused method variable that was set by ZenCart that stored the selected method which is used to carry it forward.) (Issue #34)

Download from GitHub: https://github.com/retched/ZC-USPSRestful/releases/tag/v1.1.2, ZenCart modules directory coming shortly.


8 Mar 2025, 12:49 PM
#64
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,712
Plugin Contributions:
56

Re: USPS Shipping (RESTful) (USPSr)

Just tested - you've got it! Thanks for your diligence.

8 Mar 2025, 8:56 PM
#65
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,815
Plugin Contributions:
16

Re: USPS Shipping (RESTful) (USPSr)

Using encapsuilated latest github. 500 error at plugin update.

[08-Mar-2025 20:54:03 UTC] PHP Fatal error: Uncaught Error: Call to undefined method messageStack::addSession() in /zc_plugins/USPSRestful/v1.1.2/Installer/ScriptedInstaller.php:235
Stack trace:
#0 /includes/classes/PluginSupport/ScriptedInstaller.php(76): ScriptedInstaller->executeUpgrade('v0.0.0')
#1 /includes/classes/PluginSupport/Installer.php(114): Zencart\PluginSupport\ScriptedInstaller->doUpgrade('v0.0.0')
#2 /includes/classes/PluginSupport/Installer.php(59): Zencart\PluginSupport\Installer->executeScriptedUpgrader('/home/enigjohn/...', 'v0.0.0')
#3 /includes/classes/PluginSupport/BasePluginInstaller.php(55): Zencart\PluginSupport\Installer->executeUpgraders('/home/enigjohn/...', 'v0.0.0')
#4 /includes/classes/ViewBuilders/PluginManagerController.php(302): Zencart\PluginSupport\BasePluginInstaller->processUpgrade('USPSRestful', 'v1.1.2', 'v0.0.0')
#5 /includes/classes/ViewBuilders/BaseController.php(37): Zencart\ViewBuilders\PluginManagerController->processActionDoUpgrade()
#6 /jetmar_ENL210/plugin_manager.php(101): Zencart\ViewBuilders\BaseController->processRequest()
#7 /jetmar_ENL210/index.php(16): require('/home/enigjohn/...')
#8 {main}
thrown in /zc_plugins/USPSRestful/v1.1.2/Installer/ScriptedInstaller.php on line 235

[08-Mar-2025 20:54:03 UTC] Request URI: /jetmar_ENL210/index.php?cmd=plugin_manager&page=1&colKey=USPSRestful&action=doUpgrade, IP address: 216.177.186.199
--> PHP Fatal error: Uncaught Error: Call to undefined method messageStack::addSession() in /zc_plugins/USPSRestful/v1.1.2/Installer/ScriptedInstaller.php:235
Stack trace:
#0 /includes/classes/PluginSupport/ScriptedInstaller.php(76): ScriptedInstaller->executeUpgrade('v0.0.0')
#1 /includes/classes/PluginSupport/Installer.php(114): Zencart\PluginSupport\ScriptedInstaller->doUpgrade('v0.0.0')
#2 /includes/classes/PluginSupport/Installer.php(59): Zencart\PluginSupport\Installer->executeScriptedUpgrader('/home/enigjohn/...', 'v0.0.0')
#3 /includes/classes/PluginSupport/BasePluginInstaller.php(55): Zencart\PluginSupport\Installer->executeUpgraders('/home/enigjohn/...', 'v0.0.0')
#4 /includes/classes/ViewBuilders/PluginManagerController.php(302): Zencart\PluginSupport\BasePluginInstaller->processUpgrade('USPSRestful', 'v1.1.2', 'v0.0.0')
#5 /includes/classes/ViewBuilders/BaseController.php(37): Zencart\ViewBuilders\PluginManagerController->processActionDoUpgrade()
#6 /jetmar_ENL210/plugin_manager.php(101): Zencart\ViewBuilders\BaseController->processRequest()
#7 /jetmar_ENL210/index.php(16): require('/home/enigjohn/...')
#8 {main}
thrown in /zc_plugins/USPSRestful/v1.1.2/Installer/ScriptedInstaller.php on line 235.

[08-Mar-2025 20:54:03 UTC] Request URI: /jetmar_ENL210/index.php?cmd=plugin_manager&page=1&colKey=USPSRestful&action=doUpgrade, IP address: 216.177.186.199
--> PHP Fatal error: Uncaught Error: Call to undefined method messageStack::addSession() in /zc_plugins/USPSRestful/v1.1.2/Installer/ScriptedInstaller.php:235
Stack trace:
#0 /includes/classes/PluginSupport/ScriptedInstaller.php(76): ScriptedInstaller->executeUpgrade('v0.0.0')
#1 /includes/classes/PluginSupport/Installer.php(114): Zencart\PluginSupport\ScriptedInstaller->doUpgrade('v0.0.0')
#2 /includes/classes/PluginSupport/Installer.php(59): Zencart\PluginSupport\Installer->executeScriptedUpgrader('/home/enigjohn/...', 'v0.0.0')
#3 /includes/classes/PluginSupport/BasePluginInstaller.php(55): Zencart\PluginSupport\Installer->executeUpgraders('/home/enigjohn/...', 'v0.0.0')
#4 /includes/classes/ViewBuilders/PluginManagerController.php(302): Zencart\PluginSupport\BasePluginInstaller->processUpgrade('USPSRestful', 'v1.1.2', 'v0.0.0')
#5 /includes/classes/ViewBuilders/BaseController.php(37): Zencart\ViewBuilders\PluginManagerController->processActionDoUpgrade()
#6 /jetmar_ENL210/plugin_manager.php(101): Zencart\ViewBuilders\BaseController->processRequest()
#7 /jetmar_ENL210/index.php(16): require('/home/enigjohn/...')
#8 {main}
thrown in /zc_plugins/USPSRestful/v1.1.2/Installer/ScriptedInstaller.php on line 235.
8 Mar 2025, 8:58 PM
#66
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: USPS Shipping (RESTful) (USPSr)

dbltoe:

Using encapsuilated latest github. 500 error at plugin update.

[08-Mar-2025 20:54:03 UTC] PHP Fatal error: Uncaught Error: Call to undefined method messageStack::addSession() in /zc_plugins/USPSRestful/v1.1.2/Installer/ScriptedInstaller.php:235
Stack trace:
#0 /includes/classes/PluginSupport/ScriptedInstaller.php(76): ScriptedInstaller->executeUpgrade('v0.0.0')
#1 /includes/classes/PluginSupport/Installer.php(114): Zencart\PluginSupport\ScriptedInstaller->doUpgrade('v0.0.0')
#2 /includes/classes/PluginSupport/Installer.php(59): Zencart\PluginSupport\Installer->executeScriptedUpgrader('/home/enigjohn/...', 'v0.0.0')
#3 /includes/classes/PluginSupport/BasePluginInstaller.php(55): Zencart\PluginSupport\Installer->executeUpgraders('/home/enigjohn/...', 'v0.0.0')
#4 /includes/classes/ViewBuilders/PluginManagerController.php(302): Zencart\PluginSupport\BasePluginInstaller->processUpgrade('USPSRestful', 'v1.1.2', 'v0.0.0')
#5 /includes/classes/ViewBuilders/BaseController.php(37): Zencart\ViewBuilders\PluginManagerController->processActionDoUpgrade()
#6 /jetmar_ENL210/plugin_manager.php(101): Zencart\ViewBuilders\BaseController->processRequest()
#7 /jetmar_ENL210/index.php(16): require('/home/enigjohn/...')
#8 {main}
thrown in /zc_plugins/USPSRestful/v1.1.2/Installer/ScriptedInstaller.php on line 235

[08-Mar-2025 20:54:03 UTC] Request URI: /jetmar_ENL210/index.php?cmd=plugin_manager&page=1&colKey=USPSRestful&action=doUpgrade, IP address: 216.177.186.199
--> PHP Fatal error: Uncaught Error: Call to undefined method messageStack::addSession() in /zc_plugins/USPSRestful/v1.1.2/Installer/ScriptedInstaller.php:235
Stack trace:
#0 /includes/classes/PluginSupport/ScriptedInstaller.php(76): ScriptedInstaller->executeUpgrade('v0.0.0')
#1 /includes/classes/PluginSupport/Installer.php(114): Zencart\PluginSupport\ScriptedInstaller->doUpgrade('v0.0.0')
#2 /includes/classes/PluginSupport/Installer.php(59): Zencart\PluginSupport\Installer->executeScriptedUpgrader('/home/enigjohn/...', 'v0.0.0')
#3 /includes/classes/PluginSupport/BasePluginInstaller.php(55): Zencart\PluginSupport\Installer->executeUpgraders('/home/enigjohn/...', 'v0.0.0')
#4 /includes/classes/ViewBuilders/PluginManagerController.php(302): Zencart\PluginSupport\BasePluginInstaller->processUpgrade('USPSRestful', 'v1.1.2', 'v0.0.0')
#5 /includes/classes/ViewBuilders/BaseController.php(37): Zencart\ViewBuilders\PluginManagerController->processActionDoUpgrade()
#6 /jetmar_ENL210/plugin_manager.php(101): Zencart\ViewBuilders\BaseController->processRequest()
#7 /jetmar_ENL210/index.php(16): require('/home/enigjohn/...')
#8 {main}
thrown in /zc_plugins/USPSRestful/v1.1.2/Installer/ScriptedInstaller.php on line 235.

[08-Mar-2025 20:54:03 UTC] Request URI: /jetmar_ENL210/index.php?cmd=plugin_manager&page=1&colKey=USPSRestful&action=doUpgrade, IP address: 216.177.186.199
--> PHP Fatal error: Uncaught Error: Call to undefined method messageStack::addSession() in /zc_plugins/USPSRestful/v1.1.2/Installer/ScriptedInstaller.php:235
Stack trace:
#0 /includes/classes/PluginSupport/ScriptedInstaller.php(76): ScriptedInstaller->executeUpgrade('v0.0.0')
#1 /includes/classes/PluginSupport/Installer.php(114): Zencart\PluginSupport\ScriptedInstaller->doUpgrade('v0.0.0')
#2 /includes/classes/PluginSupport/Installer.php(59): Zencart\PluginSupport\Installer->executeScriptedUpgrader('/home/enigjohn/...', 'v0.0.0')
#3 /includes/classes/PluginSupport/BasePluginInstaller.php(55): Zencart\PluginSupport\Installer->executeUpgraders('/home/enigjohn/...', 'v0.0.0')
#4 /includes/classes/ViewBuilders/PluginManagerController.php(302): Zencart\PluginSupport\BasePluginInstaller->processUpgrade('USPSRestful', 'v1.1.2', 'v0.0.0')
#5 /includes/classes/ViewBuilders/BaseController.php(37): Zencart\ViewBuilders\PluginManagerController->processActionDoUpgrade()
#6 /jetmar_ENL210/plugin_manager.php(101): Zencart\ViewBuilders\BaseController->processRequest()
#7 /jetmar_ENL210/index.php(16): require('/home/enigjohn/...')
#8 {main}
thrown in /zc_plugins/USPSRestful/v1.1.2/Installer/ScriptedInstaller.php on line 235.


I keep forgetting to not make that spelling error. Can you change the addSession to add_session for line 235.

Additionally, if you're going from 0.0.0 to a version, you should clear the old version out anyway.
8 Mar 2025, 9:13 PM
#67
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,815
Plugin Contributions:
16

Re: USPS Shipping (RESTful) (USPSr)

That worked but still getting the double est. delivey on the second option.

8 Mar 2025, 9:20 PM
#68
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: USPS Shipping (RESTful) (USPSr)

dbltoe:

That worked but still getting the double est. delivey on the second option.

Same configuration as before? Bootstrap + OPC + Edit Orders?

Do you still get this error on normal checkout by chance? Also what version of PHP do you use by chance?

8 Mar 2025, 9:29 PM
#69
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,815
Plugin Contributions:
16

Re: USPS Shipping (RESTful) (USPSr)

same config and error is on estimator first.

8 Mar 2025, 9:35 PM
#70
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: USPS Shipping (RESTful) (USPSr)

dbltoe:

same config and error is on estimator first.

Are there any other modules or add-ons that you are running? Any kind of observer that could conflict?

8 Mar 2025, 9:48 PM
#71
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,815
Plugin Contributions:
16

Re: USPS Shipping (RESTful) (USPSr)

Here's the list, but I don't see how any of them could mess with the shipping estimator.

8 Mar 2025, 10:24 PM
#72
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: USPS Shipping (RESTful) (USPSr)

dbltoe:

Here's the list, but I don't see how any of them could mess with the shipping estimator.

And can yu let me know what settings you have selected for the module? Just copy/paste the view from the Shipping Module screen. (The view before you use the edit button)

8 Mar 2025, 10:40 PM
#73
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,815
Plugin Contributions:
16

Re: USPS Shipping (RESTful) (USPSr)

*************

no good

8 Mar 2025, 10:42 PM
#74
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,815
Plugin Contributions:
16

Re: USPS Shipping (RESTful) (USPSr)

That's a funky copy, but maybe it will help.

8 Mar 2025, 10:52 PM
#75
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: USPS Shipping (RESTful) (USPSr)

Send me a screen cap of the configuration screen. I don't need the API Key and Secret. Just need to see how it is all configured.

10 Mar 2025, 6:09 PM
#76
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: USPS Shipping (RESTful) (USPSr)

retched:

I still have to look into an odd issue with the date of delivery and days count being plastered twice. (I cannot replicate this, but am looking out for it. If you encounter this, please tell me what options you used (shipping methods, etc.) right away so I can try to replicate it.)

Okay an update here: a fix for this is available, but it's kind of hacky.

In uspsr.php (if encapsulated, "\zc_plugins\USPSRestful\v1.1.2\catalog\includes\modules\shipping". Unencapsulated "\includes\modules\shipping")

Around line 942, find this:

$quote['title'] .= " [" . MODULE_SHIPPING_USPSR_TEXT_ESTIMATED_DELIVERY . " " . $est_delivery . "]";

Replace the above with:

if (strpos($quote['title'], MODULE_SHIPPING_USPSR_TEXT_ESTIMATED_DELIVERY) === FALSE) $quote['title'] .= " [" . MODULE_SHIPPING_USPSR_TEXT_ESTIMATED_DELIVERY . " " . $est_delivery . "]";

Around line 947, find this:

$quote['title'] .= " [" . MODULE_SHIPPING_USPSR_TEXT_ESTIMATED . " " . zen_uspsr_estimate_days($standard['serviceStandard']) .  "]";

Replace the above with:

if (strpos($quote['title'], MODULE_SHIPPING_USPSR_TEXT_ESTIMATED) === FALSE) $quote['title'] .= " [" . MODULE_SHIPPING_USPSR_TEXT_ESTIMATED . " " . zen_uspsr_estimate_days($standard['serviceStandard']) .  "]";

In essence, the module will check to see if there is already a copy of the string "est. delivery" or "est." as necessary. If there is not, include it. If there is, skip and do not. For some reason, the module will run itself twice and doing so caused it to add the estimate delivery time twice as well. I'll do an investigation into the code to see what could potentially cause this. But for right now, this should do.

This will be included in 1.1.3 to be released next month alongside any other fixes or improvements.

14 Mar 2025, 12:46 PM
#77
chibipaw avatar

chibipaw

Zen Follower

Join Date:
Jul 2011
Posts:
167
Plugin Contributions:
0

Re: USPS Shipping (RESTful) (USPSr)

Finally back from my travels so I can check this new module out, but I didn't get too far with it, and could use some help.
I've downloaded ver 1.1.2 Non-Encapsulated from the git repository. Copies the files where it needs to be, but it doesn't seem to work with my setup.

Once clicking on the "install" button in the admin page, it returned to the shipping module page with the module sort order/status as yellow, and no other dialogs.
Clicking on another module, then clicking on USPSr again gives me an Edit button, doesn't it doesn't actually allow me to edit anything, as the column will remain blank.

Top of the menu screen shows these errors:

USPSr Error: No services selected for USPSr module.
USPSr Error: You didn't enter an API Key and Secret. Please follow the instructions and log in to the developers dashboard to obtain your Consumer Secret and Consumer Key

Nothing I can see in the logs in the zen-cart logs directory.
This is my current configuration:
ZC Version 1.55f
PHP 7.1
MariaDB 1.44
original USPS module is installed.

Aside from the DB , Im kinda stuck in this ZC and Php version due to a number of abandonware that is in used in my production shopping cart.

14 Mar 2025, 5:36 PM
#78
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: USPS Shipping (RESTful) (USPSr)

chibipaw:

Finally back from my travels so I can check this new module out, but I didn't get too far with it, and could use some help.
I've downloaded ver 1.1.2 Non-Encapsulated from the git repository. Copies the files where it needs to be, but it doesn't seem to work with my setup.

Once clicking on the "install" button in the admin page, it returned to the shipping module page with the module sort order/status as yellow, and no other dialogs.
Clicking on another module, then clicking on USPSr again gives me an Edit button, doesn't it doesn't actually allow me to edit anything, as the column will remain blank.

Top of the menu screen shows these errors:

USPSr Error: No services selected for USPSr module.
USPSr Error: You didn't enter an API Key and Secret. Please follow the instructions and log in to the developers dashboard to obtain your Consumer Secret and Consumer Key

Nothing I can see in the logs in the zen-cart logs directory.
This is my current configuration:
ZC Version 1.55f
PHP 7.1
MariaDB 1.44
original USPS module is installed.

Aside from the DB , Im kinda stuck in this ZC and Php version due to a number of abandonware that is in used in my production shopping cart.

If you're getting a half resolved page like that, that means there was an error. Can you check your logs directory and see if one generated?

14 Mar 2025, 6:20 PM
#79
chibipaw avatar

chibipaw

Zen Follower

Join Date:
Jul 2011
Posts:
167
Plugin Contributions:
0

Re: USPS Shipping (RESTful) (USPSr)

retched:

If you're getting a half resolved page like that, that means there was an error. Can you check your logs directory and see if one generated?

I did, and I didn't see anything in there at all, thats the puzzling part.

14 Mar 2025, 7:08 PM
#80
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: USPS Shipping (RESTful) (USPSr)

chibipaw:

I did, and I didn't see anything in there at all, thats the puzzling part.

I'm 90% sure I found those errors. Working on it now.

Evidently some of the functions I used, weren't always used in ZC. Fix coming shortly.