Zen Follower
- Join Date:
- Apr 2009
- Posts:
- 125
- Plugin Contributions:
- 0
USPS Shipping (RESTful) (USPSr)
retched:
Was this a fresh install or an upgrade?
An upgrade from v1.2.0, which runs without errors.
Views: 54,964
Zen Follower
retched:
Was this a fresh install or an upgrade?
An upgrade from v1.2.0, which runs without errors.
Totally Zenned
siliconbug:
An upgrade from v1.2.0, which runs without errors.
Going to try to work backwards through this. The "easy" fix would be to uninstall 1.3.0 and reinstall 1.3.0 so the module forces the new Configuration keys in. Short of that, I'm trying to get the module to play nice with each version's incoming changes. The unencapsulated version seems to have been skipped with the new keys. I'll have an update posted to the Github and plugin listing in a few moments.
Zen Follower
Totally Zenned
siliconbug:
It works, thanks!
Some new options appeared after I uninstall/reinstall 1.3.0, such as:
Yes. Those three options, the processing class, letter size, and I forget the third off my head, are specifically for the handling of First Class Mail (not to be confused with Ground Advantage, the former First Class Package Service).
Totally Zenned
This is an emergency patch to 1.3.0 (there was a breaking change that trashed some unencapsulated installs when they went to upgrade). This patch fixes that and then some.
Added in 1.3.1
Changed in 1.3.1
Fixed in 1.3.1
This zip file includes both the Encapsulated and Non-Encapsulated forms of the module. Please read the directions of the included README.html or README.md to see how to install it and which versions of ZenCart can use which versions.
This version has been submitted to the module directory and will be available on the GitHub shortly.
Administrator
retched:
This is an emergency patch to 1.3.0 (there was a breaking change that trashed some unencapsulated installs when they went to upgrade). This patch fixes that and then some.
Added in 1.3.1
- Added a <label> field to the services list to give people a bigger "target" for selecting services.
Changed in 1.3.1
- Changed the logic of how upgrade tests and actions are performed. Instead of looking at the newer, more recent versions first, the module will now start with the oldest and go forward.
- Changed the logic in checking for newer versions of the module. (It should NOT be trying to compare the ZenCart stored version versus 0.0.0, there will ALWAYS be a "newer" version than 0.0.0 there.)
Fixed in 1.3.1
- Fixed an issue where unencapsulated installs could potentially leave out necessary configuration keys. [#59]
- Fixed an issue where the retrieved First Class Mail Letters quote would be short by $0.04. [#57]
This zip file includes both the Encapsulated and Non-Encapsulated forms of the module. Please read the directions of the included README.html or README.md to see how to install it and which versions of ZenCart can use which versions.
This version has been submitted to the module directory and will be available on the GitHub shortly.
v1.3.1 is now available for download from the Zen Cart Plugins section.
Zen Follower
Overwrite 1.3.0 to 1.3.1, and all shipping modules are killed.
Overwrite 1.3.1 to 1.3.0, and all shipping modules are back.
File Contents( /zc/logs/myDEBUG-adm-20250824-172635-056002.log)
[24-Aug-2025 17:26:35 Canada/Pacific] PHP Parse error: syntax error, unexpected ':', expecting ')' in /includes/modules/shipping/uspsr.php on line 1975[24-Aug-2025 17:26:35 Canada/Pacific] Request URI: /admindir/index.php?cmd=modules&set=shipping&module=uspsr, IP address: x.x.x.x
--> PHP Parse error: syntax error, unexpected ':', expecting ')' in /includes/modules/shipping/uspsr.php on line 1975.
Totally Zenned
siliconbug:
Overwrite 1.3.0 to 1.3.1, and all shipping modules are killed.
Overwrite 1.3.1 to 1.3.0, and all shipping modules are back.
Unencapsulated?
Wait there's nothing near line 1975 that would make that error.
Zen Follower
Yes, ZC 1.5.8a w/ php 7.4
Zen Follower
Totally Zenned
Totally Zenned
siliconbug:
Overwrite 1.3.0 to 1.3.1, and all shipping modules are killed.
Overwrite 1.3.1 to 1.3.0, and all shipping modules are back.
facepalm I found it. I have no idea why this is here... but it shouldn't be.
On line 1975: You should see this:
if (!defined(constant_name: 'MODULE_SHIPPING_USPSR_DMST_LETTER_SERVICES')) {
That "constant_name:" bit is NOT supposed to be there.
if (!defined('MODULE_SHIPPING_USPSR_DMST_LETTER_SERVICES')) {
Same with 1988:
if (!defined(constant_name: 'MODULE_SHIPPING_USPSR_INTL_LETTER_SERVICES')) {
Delete that "constant_name:" bit out of there. And if should be:
if (!defined('MODULE_SHIPPING_USPSR_INTL_LETTER_SERVICES')) {
My apologies about this.
Zen Follower
It works now, thank you!
Administrator
Version 1.3.1 has been removed for now.
That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.
Totally Zenned
[This version replaces v1.3.1 due to it being shipped with bad code. This release comes with the patch introduced to the forums. If you installed 1.3.1 while it was available, it's recommended that you uninstall the module from the admin area, if it's active in ZenCart, then overwrite with the contents of this file.]
Combined notes of 1.3.1 and 1.3.2 versions. Version 1.3.1 has been deleted from the ZenCart module directory and deleted from the GitHub repository.
Added in 1.3.1
Changed in 1.3.1
Fixed in 1.3.1
Fixed in 1.3.2
This zip file includes both the Encapsulated and Non-Encapsulated forms of the module. Please read the directions in the included README.html or README.md to see how to install it and which versions of ZenCart are compatible with each version.
This version has been submitted to ZenCart's Module Directory (with apologies to the ZenCart mods/admins and thanks for deleting the old version) and has been publish to the module's repository.
Zen Follower
It's been a few months since I've been able to get back on to this project to health issues. I am now well enough to march on.
anyways, I've picked up from 1.1.2 version to the latest v 1.3.2 off GitHub tonight.
Hoping to go live with the new USPSr module, however I've ran into a problem again.
Admin side seems to work. I now have a customer key and secret pair to plug in where it's needed.
Customer facing side, does not. During check out of Step 1 of 3 will yield a blank page if any service are selected. But if no services are selected, and the module remains ON, check out step 1 of 3 will load without any quotes or any mention of USPS. As expected, side shows an error of "USPSr Error: No services selected for USPSr module." . Perhaps its running into trouble trying to fetch the quote?
No logs are generated as before in ~/zc/logs . Perhaps php logging might have somehow be muted?
anyways, here is my configuration again.
ZC Version 1.55f
PHP 7.1
MariaDB 11.4.4
original USPS module is installed
As always appreciate looking into this in advance.
Administrator
During check out of Step 1 of 3 will yield a blank page if any service are selected.
When this happens, a debug log should be produced. Would you please post the log?
That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.
Totally Zenned
swguy:
During check out of Step 1 of 3 will yield a blank page if any service are selected.
When this happens, a debug log should be produced. Would you please post the log?
I concur that there should be an error log somewhere in PHP but luckily I managed to duplicate this. Give me a bit while I dive in. But I now see what caused it.
Totally Zenned
Got it!
Seems str_contains was not there in PHP7. (I really have to update my testing environments to use the minimum versions and not the maximums.) Removing that and replacing with the old strpos function, mends this. (I'm close to throwing out older support for PHP7. It has already reached EOL.) That said, I've already pushed two emergency rapid releases this week: I'm going to wait a bit more before pushing this through to ZenCart module DB (it will be available as v0.0.0 on the repository though).
That said, while waiting for the update to go live, patch is as follows:
In /includes/modules/shipping/uspsr.php:
Go to line 2341-2348 (and 2406-2413) and find this:
[
"isPolybagged" => str_contains(MODULE_SHIPPING_USPSR_LTR_MACHINEABLE_FLAGS, "Polybagged"),
"hasClosureDevices" => str_contains(MODULE_SHIPPING_USPSR_LTR_MACHINEABLE_FLAGS, "ClosureDevices"),
"hasLooseItems" => str_contains(MODULE_SHIPPING_USPSR_LTR_MACHINEABLE_FLAGS, "LooseItems"),
"isRigid" => str_contains(MODULE_SHIPPING_USPSR_LTR_MACHINEABLE_FLAGS, "Rigid"),
"isSelfMailer" => str_contains(MODULE_SHIPPING_USPSR_LTR_MACHINEABLE_FLAGS, "SelfMailer"),
"isBooklet" => str_contains(MODULE_SHIPPING_USPSR_LTR_MACHINEABLE_FLAGS, "Booklet"),
],
and replace with this:
[
"isPolybagged" => strpos(MODULE_SHIPPING_USPSR_LTR_MACHINEABLE_FLAGS, "Polybagged") !== false,
"hasClosureDevices" => strpos(MODULE_SHIPPING_USPSR_LTR_MACHINEABLE_FLAGS, "ClosureDevices") !== false,
"hasLooseItems" => strpos(MODULE_SHIPPING_USPSR_LTR_MACHINEABLE_FLAGS, "LooseItems") !== false,
"isRigid" => strpos(MODULE_SHIPPING_USPSR_LTR_MACHINEABLE_FLAGS, "Rigid") !== false,
"isSelfMailer" => strpos(MODULE_SHIPPING_USPSR_LTR_MACHINEABLE_FLAGS, "SelfMailer") !== false,
"isBooklet" => strpos(MODULE_SHIPPING_USPSR_LTR_MACHINEABLE_FLAGS, "Booklet") !== false,
],
When making this change, DO NOT FORGOT the extra comma on the last line. This will repair function for PHP 7 and is functionally identical on PHP8. (This change only applies to older ZenCarts.)
Zen Follower
swguy:
During check out of Step 1 of 3 will yield a blank page if any service are selected.
When this happens, a debug log should be produced. Would you please post the log?
Thats just it, no myDEBUG log files at all. Im wondering if there are some setting in php or something that is mumessages or it's just going out without any errors and debug is set on in the module.
Tell staff why this post should be reviewed.