You SHOULD be able to use the following gists. Just be sure to put the languages file where necessary and rename them. (the admin.uspsr.php should be copied to /admin/includes/languages/english/extra_definitions/uspsr.php and the catalog.uspsr.php file should be copied to catalog\includes\languages\english\modules\shipping\ . Both should be named to JUST uspsr.php)
https://gist.github.com/retched/bcf6...1e472bc741976a
Coming back in a later edit innately (probably the next edit once I fix the quote issue right now). The way I have to pull the JSON file presently is a bit cumbersome but I'm 95% sure it can be done to compare it against a maximum/minimum weight like before.
There is a way to use an observer class (NOTIFY_USPS_UPDATE_OR_DISALLOW_TYPE) to in effect disable a shipping method. But that might be too cumbersome.
Im in a similar situation where I will be stuck in with an older version of ZC until a complete tear down can happen. Which its going to be quite catastrophic since it a 15 year old cart that had been through as much as upgrades as reasonably can. In the light of the USPS api retirement notice, I'm interested to see if this would work reliably in a production environment that really can't be upgraded any further.
Any efforts to provide some reasonable backward compatibility would be greatly appreciated.
Wait you mean 1.5.5f right?
Yes, not by choice as mentioned.
FWIW, given my short code review, I believe that this version of USPS could be made usable on Zen Cart versions prior to 1.5.8 and PHP versions prior to 7.3/4 by
- Providing a non-array-based language file, i.e. using the older define-statement method.
- Changing the use of the null-coalesce operator (??) to use the older tertiary operator, e.g. if (($x ?? 7)) becomes if (isset($x) ? $x : 7).
If it's at all possible, that is very much appreciated. Im sure not just by me, but buy a lot of people who are kind of stuck in this situation.
Bookmarks