scottcwilson / zencart_fedexrest

Zen Cart shipping module for FedEx, using the new RESTful API.
Other
0 stars 3 forks source link

No quote to ship to New Zealand, Germany and Spain #10

Closed njcyx closed 3 months ago

njcyx commented 3 months ago

Log files:

[code] => RECIPIENT.ADDRESSSTATEORPROVINCECODE.MAXCHAREXCEEDED [message] => The length of the destination state or province code exceeds the limit of 2 characters. Please update and try again.

Fix:

Add the following lines near line 328:

     $skip_state_country = array ('NZ','DE','ES');
     if(in_array($country_id, $skip_state_country))
        $state = '';

Explain:

By zen cart default, the states/provinces for those three countries are three-letter or more, not two-letter (like US). When pass state info to FedEx server, it will show error. If I delete the state info, I can get the shipping quote normally.

Somehow, I can get the USPS shipping quote properly without any changes.

scottcwilson commented 3 months ago

Please PR but instead of what you have done, skip the state if the state is over 2 characters. (Add a comment with NZ, DE, ES as examples.)

njcyx commented 3 months ago

Done. Not sure if any other countries are affected. My zc has 7 countries which have zones by default: US, Canada, Austria, Germany, New Zealand, Spain, Switzerland. I can get a quote for other 4 countries, so no change in the code.

scottcwilson commented 3 months ago

Merged and released.