Re: USPS Shipping (RESTful) (USPSr)
Quote:
Originally Posted by
spyderrobotics
Using 1.5.7c and installed the non-encapsulated version. Couple of issues. In the admin panel the module didn't show and it gave an error because it was looking for uspsr.php in the languages>english>modules>shipping folder. The file is actually named lang.uspsr.php. So I just renamed it to uspsr.php and then the module showed up and I was able to configure it. The module works but it also is not grabbing some of the names correctly. For instance when you get a quote it would show MODULE_SHIPPING_USPSR_TEXT_SHORT_TITLE (Ground Advantage) to the user.
I edited line 245 in the module and just changed it to $this->title = 'United States Postal Service';
It does something similar with the name of the module under the admin>module>shipping.
I was able to edit those to get things looking right. Not sure why its not getting the data from the other files. My issue is with the other usps module you could select the weight for each shipping type. For instance I only want up to 1 lb for ground advantage and priority limited to 1 lb or more. Is there a way to put that option back in or any idea where to edit the files to manually put that back in?
Quote:
Originally Posted by
lat9
Right, the USPS/RESTful provides only new-style language files (i.e. lang.uspsr.php); that form of language-file was introduced in zc158.
Yeah as lat9 said, I made this for 1.5.8 onward given that the older style of language files are being phased out. It CAN work with some muscle for 1.5.7, but I would have to rewrite all of the language files to do so.
Re: USPS Shipping (RESTful) (USPSr)
Quote:
Originally Posted by
retched
Yeah as lat9 said, I made this for 1.5.8 onward given that the older style of language files are being phased out. It CAN work with some muscle for 1.5.7, but I would have to rewrite all of the language files to do so.
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
Re: USPS Shipping (RESTful) (USPSr)
Quote:
Originally Posted by
spyderrobotics
My issue is with the other usps module you could select the weight for each shipping type
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.
Re: USPS Shipping (RESTful) (USPSr)
Quote:
Originally Posted by
retched
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
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.
Re: USPS Shipping (RESTful) (USPSr)
Quote:
Originally Posted by
chibipaw
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.
Which version of ZC are you on?
Re: USPS Shipping (RESTful) (USPSr)
Quote:
Originally Posted by
retched
Which version of ZC are you on?
With munch embarrassment, 1.55f. Because too many active dependencies that are now abandonware, and this is a very active production site.
Re: USPS Shipping (RESTful) (USPSr)
Wait you mean 1.5.5f right?
Re: USPS Shipping (RESTful) (USPSr)
Yes, not by choice as mentioned.
Re: USPS Shipping (RESTful) (USPSr)
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).
Re: USPS Shipping (RESTful) (USPSr)
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.