USPS Shipping (RESTful) (USPSr)
USPS Shipping (RESTful) for Zen Cart
This module provides sellers a chance to offer United States Postal Service (USPS) shipping rates to customers during checkout. This is done by pulling the rates directly from the USPS' REST API.
This module supports versions 1.5.8 onward innately. (Support from 1.5.7 and backward is not necessarily guaranteed but is plausible. Read the Installation steps below for more details.) This script was primarily written with PHP8 in mind. (It might have problems working with PHP7.)
There isn't much difference between the two versions. However, if you managed to get the WebTools version to work, CONTINUE TO USE THAT VERSION.
USPS API Documentation: https://developers.usps.com/apis
This API takes advantage of four API's: Domestic Prices 3.0, International Prices 3.0, Service Standards 3.0, and OAuth 3.0.
ZenCart Plugins Download: https://www.zen-cart.com/downloads.php?do=file&id=2395 (Pending) (or use the Releases function on the GitHub repository)
GitHub Repository: https://github.com/retched/ZC-USPSRestful
** This thread is only for the USPSr version of the USPS module. For assistance with the original USPS module which uses the WebTools API, you should post in its megathread: https://www.zen-cart.com/showthread....Support-Thread
Re: USPS Shipping (RESTful) (USPSr)
i tried to install in zen210 through plugin module and it error on shipping modules say if you were adding data press the back button and shipping modules stop showing after last 1. same thing happens with the web tools version also.
no error log is produced.
Re: USPS Shipping (RESTful) (USPSr)
Quote:
Originally Posted by
jimmie
i tried to install in zen210 through plugin module and it error on shipping modules say if you were adding data press the back button and shipping modules stop showing after last 1. same thing happens with the web tools version also.
no error log is produced.
This sounds like a cookie issue. What do you mean by "error on shipping modules"? Also be sure that if you have the problem on WebTools, you make a post on the WebTools version as well.
Re: USPS Shipping (RESTful) (USPSr)
Quote:
Originally Posted by
retched
This sounds like a cookie issue. What do you mean by "error on shipping modules"? Also be sure that if you have the problem on WebTools, you make a post on the WebTools version as well.
when i go to shipping modules message at the top says to refresh page
when looking at modules all the other shipping modules configuration settings are missing
Re: USPS Shipping (RESTful) (USPSr)
Are you sure there are no error logs generated? What other modules/add ons do you have? What browser add-ons do you have?
Re: USPS Shipping (RESTful) (USPSr)
Found the problem:
[ALTER TABLE orders MODIFY shipping_method varchar(255) NOT NULL DEFAULT '']
This happens when the module is enabled seems something changed it to TEXT and both my module and the WebTools module tries to revert it back to VARCHAR(255). I'm going to modify my module to check to see if the column is either 255 or TEXT.
Re: USPS Shipping (RESTful) (USPSr)
Incoming Changes for Version 0.2.0
Added
- Module will now disable itself if it sees that SHIPPING_ORIGIN_ZIP is not a valid 5-digit or 9-digit ZIP Code.
- Additional warnings are now present on the module line in the listing of modules.
- Added a note to the Debug Log about what the shipping origin zip code setting is.
Changed
- Changed the module's installation message with regards to the measurements. (Going forward, if the store owner changes the setting for `SHIPPING_WEIGHT_UNITS` at the time of installation, the message for the default measurements will also change.)
- Changed the value of "Estimate Time" to "Estimate Transit Time" for the `MODULE_SHIPPING_USPSR_DISPLAY_TRANSIT` constant for clarity. During the upgrade, if "Estimate Time" is the option, it will change to "Estimate Transit Time" automatically.
- Changed the encapsulated plugin's "description" to read a bit better. (This has no function on the operation of the plugin but it was irritating to look at as it referenced parts not available in the regular parts of the module.)
Fixed
- [BUG] Resolved issue [#4]: (Loading the file via Plugin Manager generates a crash). This was resolved by an emergency patch to the release files but is being properly deployed now. (This patch has been undone as the module is now active on the ZenCart Plugins Database.)
- [BUG] Resolved issue [#5]: Stops error message complaining about a `NULL` value for `$order->delivery['street_address']` when searching if a delivery address is either a `PO_BOX` or `STREET` address. This normally happens when you try to use the module on something like the Shipping Estimator where there is no address set.
- [BUG] Resolved issue [#7]: First Class Mail International Service missing from quotes. This was apparently repaired by the USPS API Tech Team. The quote is now reinstated alongside other international quotes. Additionally, both quotes now will carry the estimated value of the cart alongside it. This is important as there are no limits on domestic shipments but there is a limit of roughly $400 for First Class Mail Package Service and a limit of about $600 to as much $5000 for other services (depending on the country). If the request is too much, the quote will not return anything as it is outside of the range. Additionally, international insurance is now properly applied where necessary.
- [BUG] Resolved issue [#8]: Shipping Modules listing crashes when module loads. This happens when the `TABLE_ORDERS` has a `shipping_method` column set to `TEXT` and is filled with larger data. Originally the module, during the `_check()` process, would see if the column was set to be a `VARCHAR(255)`. If it was set to anything but a `VARCHAR(255)`, the module would try to issue an `ALTER TABLE` SQL command and force it to be a `VARCHAR(255)`. This would backfire as ZenCart would catch a MYSQL error on the tune of "Data too big" and just crash the entire backend. This change will now ignore the column if it's set to anything bigger than a `VARCHAR` (namely TEXT, MEDIUMTEXT or BLOB).
- [BUG] Fixed double spacing present on all quoted process names. (These extra spaces weren't visible anywhere else other than the logfile and maybe the raw source code too if you looked hard enough for it.)
Removed
- Dropped International Return Receipt as that service has been deprecated since January 19, 2025.
- Deleted the changelog attached to the release directory and removed the reference from the encapsulated manifest file. Going forward, the manifest should link to the releases tab on the repository at GitHub. The 0.1.0 release manifest also has been changed to match.
===
Going forward, in addition to posting it on the Repository, an encapsulated and non-encapsulated version of the module will be posted to the directory.
Re: USPS Shipping (RESTful) (USPSr)
I am trying to install the current version of the USPS shipping module into a new 2.1.0 application.
The README in the plugin download states it is installed using the new Encapsulated Plugin Manager.
How do you add the USPS plugin and install it in the Plugin Manager?
Re: USPS Shipping (RESTful) (USPSr)
Quote:
Originally Posted by
jodean
I am trying to install the current version of the USPS shipping module into a new 2.1.0 application.
The README in the plugin download states it is installed using the new Encapsulated Plugin Manager.
How do you add the USPS plugin and install it in the Plugin Manager?
Hi, sorry the language wasn't clear.
When you download the module, either from the ZenCart Plugin Database or off the repository, you'll be given two choices: download the Encapsulated OR download the non-Encapsulated. Download the encapsulated version and there will be a Zip Folder that contains a folder named 'zc_plugin'. Extract the contents of that directory into the matching zc_plugin directory on your ZenCart installation. Visit your ZenCart Admin area and then visit Modules > Plugin Manager and there should be a new option named "USPS Shipping (w/REST API) for Zen Cart". Click on that row, then choose install. And if all worked well, you will see that it has been installed as well as a new option available under Modules > Shipping.
Re: USPS Shipping (RESTful) (USPSr)
Quote:
Originally Posted by
retched
Hi, sorry the language wasn't clear.When you download the module, either from the ZenCart Plugin Database or off the repository, you'll be given two choices: download the Encapsulated OR download the non-Encapsulated. Download the encapsulated version and there will be a Zip Folder that contains a folder named 'zc_plugin'. Extract the contents of that directory into the matching zc_plugin directory on your ZenCart installation. Visit your ZenCart Admin area and then visit Modules > Plugin Manager and there should be a new option named "USPS Shipping (w/REST API) for Zen Cart". Click on that row, then choose install. And if all worked well, you will see that it has been installed as well as a new option available under Modules > Shipping.
I just tried to download USPS again from the Zencart Plugins and it does not prompt for to download Encapsulated or non-Encapsulated.