lat9 / usps

USPS shipping module for Zen Cart
Other
1 stars 3 forks source link

Storefront error retrieving quotes when no services selected during admin configuration #14

Closed lat9 closed 4 years ago

lat9 commented 4 years ago

Seeing

-2147221202 - The element 'RateV4Request' has incomplete content. List of possible elements expected: 'RateClientType, Package'

Turns out it was because I had "only" entered the account number, and not turned on any of the Services. Since all the checkboxes default to "off", USPS was generating invalid XML for the request. Er, well, not actually invalid XML but rather an invalid request because child elements were missing. There are 2 of these

foreach ($this->typeCheckboxesSelected as $requested_type) {

sections in the code, but neither checks to see if the typeCheckboxesSelected is empty.

Perhaps it would be good to disable the module if no services are selected for any of the sections it quotes for. (eg: return a valid empty list of quotes so no "undefined index" messages are thrown in catalog templates. ...

I was getting this when the -2147221202 error was triggered:

"--> PHP Notice: Undefined index: methods in /v157/includes/modules/pages/checkout_shipping/header_php.php on line 190."
lat9 commented 4 years ago

Noting that this correction also corrects the persistent 'Missing Keys ... ' message issued by the admin; the full module-version string wasn't being recorded in the module's configuration.