Totally Zenned
- Join Date:
- Jan 2013
- Location:
- New Port Richey, Florida
- Posts:
- 971
- Plugin Contributions:
- 0
USPS Shipping (RESTful) (USPSr)
your module though is the only 1 not showing up when not logged in, all other shipping modules show
Views: 54,962
Totally Zenned
your module though is the only 1 not showing up when not logged in, all other shipping modules show
Totally Zenned
jimmie:
your module though is the only 1 not showing up when not logged in, all other shipping modules show
Looks like I have to investigate why that is.
Totally Zenned
jimmie:
that did not work, I used find and replace all instances of apis.usps.com to api.usps.com
I would be willing to bet that a look in those files would find some api.usps.com/#)(#()#)__+
When you do a find and replace, it only replaces what you tell it to. It's kinda stubborn about that.:P
So, when you told it to change, basically only the apis to api, the original file https://apis.usps.com/prices/v3/total-rates/search became *https://api.usps.com/prices/v3/total-rates/search
*You're going to need to go back and get rid of everything after https://api.com
Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com
Totally Zenned
jimmie:
your module though is the only 1 not showing up when not logged in, all other shipping modules show
Random question: where are you getting the ID and Secret being used? https://developer.usps.com or https://developers.usps.com (note the S)
Totally Zenned
Totally Zenned
retched:
Meant either
Or
Note the extra s
Totally Zenned
jimmie:
Okay yeah I have to rewrite these urls. So leaving it as apis.usps.com is the play. It works on my naked ZenCart 2.1.0 but for some reason revocation calls are busted. I can make calls from the not logged in shipping estimator and get results but for some reason, revoking the token isn't working. I'm still playing email tag with the USPS API support team to figure out what's wrong. (I'm probably going to stop revoking the token for now and instead of making multiple requests to generate it, use server-side sessions instead to store the token.)
So all USPS APIs should be called from https://apis.usps.com/ .
I have no idea why the plain developer.usps.com site is functioning in that case as they told me it's deprecated (even I used it last a few days ago). It even still serves API credentials but the version is out of date (3.0.4 vs 3.0.6)
Totally Zenned
retched:
Okay yeah I have to rewrite these urls. So leaving it as apis.usps.com is the play. It works on my naked ZenCart 2.1.0 but for some reason revocation calls are busted. I can make calls from the not logged in shipping estimator and get results but for some reason, revoking the token isn't working. I'm still playing email tag with the USPS API support team to figure out what's wrong. (I'm probably going to stop revoking the token for now and instead of making multiple requests to generate it, use server-side sessions instead to store the token.)
So all USPS APIs should be called from https://apis.usps.com/ .
I have no idea why the plain developer.usps.com site is functioning in that case as they told me it's deprecated (even I used it last a few days ago). It even still serves API credentials but the version is out of date (3.0.4 vs 3.0.6)
Like I genuinely wish I had better answers here but I cannot for the life of me figure why it's breaking this badly.
Totally Zenned
jimmie:
but transit day delay still not saving
Figured out what happened here. I can't give an "easy" fix because it requires updating the configuration table in the DB and a language file but in short, I tried to recreate the wheel without thinking on it to see if something can already handle it. Now I'm trying to see about the val_function in the database.
Totally Zenned
jimmie:
Yes i did, i also applied this to shipping estimator
https://www.zen-cart.com/showthread.php/198719-Hide-Available-Shipping-Methods-table-until-Shipping-Estimator-runs?p=1404879#post1404879
In doing this... do you also have a footer? Like the page loads normally?
Totally Zenned
retched:
In doing this... do you also have a footer? Like the page loads normally?
Nevermind this, I forgot to make the language file available.
Can confirm, I have the module running with this change and can see quotes.
Totally Zenned
Working through the night, can confirm the following:
I will be making a patch in a few hours(?) addressing these three points and the addition of USPS First Class Mail Letters. (I've stalled on this but will be back working at it again... probably will have to do a soft restart as I broke the repository with the branch switches.)
Totally Zenned
Added in 1.3.0
Changed in 1.3.0
$_SESSION in PHP. Rather than generate a new AuthToken on every page visit, the module will check if there is already an AuthToken already made and if there is not, THEN make a new AuthToken at that point. (AuthTokens last for roughly eight hours. So long as there aren't more than 60 requests per hour. If there is a chance you might go above that, no problem... simply request the API Team to provision you more requests.)v0.0.0 version from the Repository will now have a warning banner appear in the admin backend. That warning uses the messageStack system and will link to the ZenCart thread and this repository on GitHub.Breaking in 1.3.0
Submitted to ZenCart directory, now available for download on GitHub.
Totally Zenned
And in my rush to make the First Class Mail Letter available, I forgot to re-add in the four cent differential between the Metered Mail and Non-Metered Mail Rates.
I will push this out in a future version but in case anyone wanted to make the change now, open /catalog/includes/modules/shipping/uspsr.php (either encapsulated or unencapsulated) and make the following change around line 392.
Add the following below the line 391:
if ($this->usps_countries == 'US') {// Only applies to US
# Bug fix for letters since the metered rate is four cents less.
$_letter['rates'][0]['price'] += 0.04;
$_letter['totalBasePrice'] += 0.04;
}
Zen Follower
Is version 1.3.0 compatible only with ZenCart 2.1.0?
The README.html states: "Released August 16, 2025 for ZenCart 2.1.0."
Zen Follower
Update:
I'm using the same non-encapsulated version for ZenCart 1.5.5+.
I don’t use the First-Class Letter service, but I did try adding the related code anyway.
Regardless of whether the code is included or not, I’m still getting the same error log.
It’s quite lengthy, so let me know if you'd like me to post it here.
Totally Zenned
siliconbug:
Update:
I'm using the same non-encapsulated version for ZenCart 1.5.5+.I don’t use the First-Class Letter service, but I did try adding the related code anyway.
Regardless of whether the code is included or not, I’m still getting the same error log.
It’s quite lengthy, so let me know if you'd like me to post it here.
Need to see the errorLog to help with this.
Zen Follower
ZC 1.5.8a w/ php 7.4
I can still get the estimate shipping costs correctly.
[23-Aug-2025 00:21:51 Canada/Pacific] Request URI: /index.php?main_page=shopping_cart, IP address: x.x.x.x, Language id 1
#1 uspsr->_getQuote() called at [/zc/includes/modules/shipping/uspsr.php:376]
#2 uspsr->quote() called at [/zc/includes/classes/shipping.php:201]
#3 shipping->quote() called at [/zc/includes/modules/shipping_estimator.php:151]
#4 require(/zc/includes/modules/shipping_estimator.php) called at [/zc/includes/templates/bootstrap/templates/tpl_shopping_cart_default.php:229]
#5 require(/zc/includes/templates/bootstrap/templates/tpl_shopping_cart_default.php) called at [/zc/includes/templates/bootstrap/common/tpl_main_page.php:233]
#6 require(/zc/includes/templates/bootstrap/common/tpl_main_page.php) called at [/zc/index.php:94]
--> PHP Warning: Use of undefined constant MODULE_SHIPPING_USPSR_LTR_DIMMENSIONS - assumed 'MODULE_SHIPPING_USPSR_LTR_DIMMENSIONS' (this will throw an Error in a future version of PHP) in /zc/includes/modules/shipping/uspsr.php on line 2122.
[23-Aug-2025 00:21:51 Canada/Pacific] Request URI: /index.php?main_page=shopping_cart, IP address: x.x.x.x, Language id 1
#1 uspsr->_getQuote() called at [/zc/includes/modules/shipping/uspsr.php:376]
#2 uspsr->quote() called at [/zc/includes/classes/shipping.php:201]
#3 shipping->quote() called at [/zc/includes/modules/shipping_estimator.php:151]
#4 require(/zc/includes/modules/shipping_estimator.php) called at [/zc/includes/templates/bootstrap/templates/tpl_shopping_cart_default.php:229]
#5 require(/zc/includes/templates/bootstrap/templates/tpl_shopping_cart_default.php) called at [/zc/includes/templates/bootstrap/common/tpl_main_page.php:233]
#6 require(/zc/includes/templates/bootstrap/common/tpl_main_page.php) called at [/zc/index.php:94]
--> PHP Warning: Use of undefined constant MODULE_SHIPPING_USPSR_DMST_LETTER_SERVICES - assumed 'MODULE_SHIPPING_USPSR_DMST_LETTER_SERVICES' (this will throw an Error in a future version of PHP) in /zc/includes/modules/shipping/uspsr.php on line 2157.
[23-Aug-2025 00:21:51 Canada/Pacific] Request URI: /index.php?main_page=shopping_cart, IP address: x.x.x.x, Language id 1
#1 uspsr->_getQuote() called at [/zc/includes/modules/shipping/uspsr.php:376]
#2 uspsr->quote() called at [/zc/includes/classes/shipping.php:201]
#3 shipping->quote() called at [/zc/includes/modules/shipping_estimator.php:151]
#4 require(/zc/includes/modules/shipping_estimator.php) called at [/zc/includes/templates/bootstrap/templates/tpl_shopping_cart_default.php:229]
#5 require(/zc/includes/templates/bootstrap/templates/tpl_shopping_cart_default.php) called at [/zc/includes/templates/bootstrap/common/tpl_main_page.php:233]
#6 require(/zc/includes/templates/bootstrap/common/tpl_main_page.php) called at [/zc/index.php:94]
--> PHP Warning: Use of undefined constant MODULE_SHIPPING_USPSR_INTL_LETTER_SERVICES - assumed 'MODULE_SHIPPING_USPSR_INTL_LETTER_SERVICES' (this will throw an Error in a future version of PHP) in /zc/includes/modules/shipping/uspsr.php on line 2158.
[23-Aug-2025 00:21:51 Canada/Pacific] Request URI: /index.php?main_page=shopping_cart, IP address: x.x.x.x, Language id 1
#1 uspsr->_getQuote() called at [/zc/includes/modules/shipping/uspsr.php:376]
#2 uspsr->quote() called at [/zc/includes/classes/shipping.php:201]
#3 shipping->quote() called at [/zc/includes/modules/shipping_estimator.php:151]
#4 require(/zc/includes/modules/shipping_estimator.php) called at [/zc/includes/templates/bootstrap/templates/tpl_shopping_cart_default.php:229]
#5 require(/zc/includes/templates/bootstrap/templates/tpl_shopping_cart_default.php) called at [/zc/includes/templates/bootstrap/common/tpl_main_page.php:233]
#6 require(/zc/includes/templates/bootstrap/common/tpl_main_page.php) called at [/zc/index.php:94]
--> PHP Warning: Use of undefined constant MODULE_SHIPPING_USPSR_LTR_PROCESSING - assumed 'MODULE_SHIPPING_USPSR_LTR_PROCESSING' (this will throw an Error in a future version of PHP) in /zc/includes/modules/shipping/uspsr.php on line 2257.
[23-Aug-2025 00:21:51 Canada/Pacific] Request URI: /index.php?main_page=shopping_cart, IP address: x.x.x.x, Language id 1
#1 uspsr->_getQuote() called at [/zc/includes/modules/shipping/uspsr.php:376]
#2 uspsr->quote() called at [/zc/includes/classes/shipping.php:201]
#3 shipping->quote() called at [/zc/includes/modules/shipping_estimator.php:151]
#4 require(/zc/includes/modules/shipping_estimator.php) called at [/zc/includes/templates/bootstrap/templates/tpl_shopping_cart_default.php:229]
#5 require(/zc/includes/templates/bootstrap/templates/tpl_shopping_cart_default.php) called at [/zc/includes/templates/bootstrap/common/tpl_main_page.php:233]
#6 require(/zc/includes/templates/bootstrap/common/tpl_main_page.php) called at [/zc/index.php:94]
--> PHP Warning: Use of undefined constant MODULE_SHIPPING_USPSR_LTR_MACHINEABLE_FLAGS - assumed 'MODULE_SHIPPING_USPSR_LTR_MACHINEABLE_FLAGS' (this will throw an Error in a future version of PHP) in /zc/includes/modules/shipping/uspsr.php on line 2260.
[23-Aug-2025 00:21:51 Canada/Pacific] Request URI: /index.php?main_page=shopping_cart, IP address: x.x.x.x, Language id 1
#1 uspsr->_getQuote() called at [/zc/includes/modules/shipping/uspsr.php:376]
#2 uspsr->quote() called at [/zc/includes/classes/shipping.php:201]
#3 shipping->quote() called at [/zc/includes/modules/shipping_estimator.php:151]
#4 require(/zc/includes/modules/shipping_estimator.php) called at [/zc/includes/templates/bootstrap/templates/tpl_shopping_cart_default.php:229]
#5 require(/zc/includes/templates/bootstrap/templates/tpl_shopping_cart_default.php) called at [/zc/includes/templates/bootstrap/common/tpl_main_page.php:233]
#6 require(/zc/includes/templates/bootstrap/common/tpl_main_page.php) called at [/zc/index.php:94]
--> PHP Warning: Use of undefined constant MODULE_SHIPPING_USPSR_LTR_MACHINEABLE_FLAGS - assumed 'MODULE_SHIPPING_USPSR_LTR_MACHINEABLE_FLAGS' (this will throw an Error in a future version of PHP) in /zc/includes/modules/shipping/uspsr.php on line 2261.
[23-Aug-2025 00:21:51 Canada/Pacific] Request URI: /index.php?main_page=shopping_cart, IP address: x.x.x.x, Language id 1
#1 uspsr->_getQuote() called at [/zc/includes/modules/shipping/uspsr.php:376]
#2 uspsr->quote() called at [/zc/includes/classes/shipping.php:201]
#3 shipping->quote() called at [/zc/includes/modules/shipping_estimator.php:151]
#4 require(/zc/includes/modules/shipping_estimator.php) called at [/zc/includes/templates/bootstrap/templates/tpl_shopping_cart_default.php:229]
#5 require(/zc/includes/templates/bootstrap/templates/tpl_shopping_cart_default.php) called at [/zc/includes/templates/bootstrap/common/tpl_main_page.php:233]
#6 require(/zc/includes/templates/bootstrap/common/tpl_main_page.php) called at [/zc/index.php:94]
--> PHP Warning: Use of undefined constant MODULE_SHIPPING_USPSR_LTR_MACHINEABLE_FLAGS - assumed 'MODULE_SHIPPING_USPSR_LTR_MACHINEABLE_FLAGS' (this will throw an Error in a future version of PHP) in /zc/includes/modules/shipping/uspsr.php on line 2262.
[23-Aug-2025 00:21:51 Canada/Pacific] Request URI: /index.php?main_page=shopping_cart, IP address: x.x.x.x, Language id 1
#1 uspsr->_getQuote() called at [/zc/includes/modules/shipping/uspsr.php:376]
#2 uspsr->quote() called at [/zc/includes/classes/shipping.php:201]
#3 shipping->quote() called at [/zc/includes/modules/shipping_estimator.php:151]
#4 require(/zc/includes/modules/shipping_estimator.php) called at [/zc/includes/templates/bootstrap/templates/tpl_shopping_cart_default.php:229]
#5 require(/zc/includes/templates/bootstrap/templates/tpl_shopping_cart_default.php) called at [/zc/includes/templates/bootstrap/common/tpl_main_page.php:233]
#6 require(/zc/includes/templates/bootstrap/common/tpl_main_page.php) called at [/zc/index.php:94]
--> PHP Warning: Use of undefined constant MODULE_SHIPPING_USPSR_LTR_MACHINEABLE_FLAGS - assumed 'MODULE_SHIPPING_USPSR_LTR_MACHINEABLE_FLAGS' (this will throw an Error in a future version of PHP) in /zc/includes/modules/shipping/uspsr.php on line 2263.
[23-Aug-2025 00:21:51 Canada/Pacific] Request URI: /index.php?main_page=shopping_cart, IP address: x.x.x.x, Language id 1
#1 uspsr->_getQuote() called at [/zc/includes/modules/shipping/uspsr.php:376]
#2 uspsr->quote() called at [/zc/includes/classes/shipping.php:201]
#3 shipping->quote() called at [/zc/includes/modules/shipping_estimator.php:151]
#4 require(/zc/includes/modules/shipping_estimator.php) called at [/zc/includes/templates/bootstrap/templates/tpl_shopping_cart_default.php:229]
#5 require(/zc/includes/templates/bootstrap/templates/tpl_shopping_cart_default.php) called at [/zc/includes/templates/bootstrap/common/tpl_main_page.php:233]
#6 require(/zc/includes/templates/bootstrap/common/tpl_main_page.php) called at [/zc/index.php:94]
--> PHP Warning: Use of undefined constant MODULE_SHIPPING_USPSR_LTR_MACHINEABLE_FLAGS - assumed 'MODULE_SHIPPING_USPSR_LTR_MACHINEABLE_FLAGS' (this will throw an Error in a future version of PHP) in /zc/includes/modules/shipping/uspsr.php on line 2264.
[23-Aug-2025 00:21:51 Canada/Pacific] Request URI: /index.php?main_page=shopping_cart, IP address: x.x.x.x, Language id 1
#1 uspsr->_getQuote() called at [/zc/includes/modules/shipping/uspsr.php:376]
#2 uspsr->quote() called at [/zc/includes/classes/shipping.php:201]
#3 shipping->quote() called at [/zc/includes/modules/shipping_estimator.php:151]
#4 require(/zc/includes/modules/shipping_estimator.php) called at [/zc/includes/templates/bootstrap/templates/tpl_shopping_cart_default.php:229]
#5 require(/zc/includes/templates/bootstrap/templates/tpl_shopping_cart_default.php) called at [/zc/includes/templates/bootstrap/common/tpl_main_page.php:233]
#6 require(/zc/includes/templates/bootstrap/common/tpl_main_page.php) called at [/zc/index.php:94]
--> PHP Warning: Use of undefined constant MODULE_SHIPPING_USPSR_LTR_MACHINEABLE_FLAGS - assumed 'MODULE_SHIPPING_USPSR_LTR_MACHINEABLE_FLAGS' (this will throw an Error in a future version of PHP) in /zc/includes/modules/shipping/uspsr.php on line 2265.
Totally Zenned
Something didn't run correctly. One moment.
Was this a fresh install or an upgrade?
Totally Zenned
siliconbug:
Is version 1.3.0 compatible only with ZenCart 2.1.0?
The README.html states: "Released August 16, 2025 for ZenCart 2.1.0."
To answer this, the module is still compatible with older versions of ZC up to 1.5.5 (anything before that and it's a mystery bag).
Tell staff why this post should be reviewed.