Jump to content

Postal code error after updating to 1.6.1.1


Recommended Posts

Hi


 


I'm from Japan and after I update from 1.6.0.14 to  1.6.1.1  the Zip code generate error (Attached ZipCode)


 


The postal code in Japan is 000-0000


 


I Check the postal code  in Menu Location - Country - Japan as default (attached Location)


 


No matter what country or zip code I enter the result is always the same , after i insert the postal code the prestashop red warning Appear  ... postal code is invalid


 


 


Please advice how to fix it  or how remove the red warning in the ZIP field?


 


THX


post-254921-0-51278400-1440665605_thumb.jpg

post-254921-0-60716900-1440665618_thumb.jpg

Edited by stefanoste (see edit history)
Link to comment
Share on other sites

Please check that there is not an override (from some module) in:

 

override/controllers/front/AddressController.php or AuthController.php

 

because to me, because it works out of the box on native, that something has been changed to cause failure.

Link to comment
Share on other sites

Hi Guys,

i'm from Italy, i have the same problem with Zip code.

In override/controllers/front/ i have only the index.php ..no other files.

I have deleted also the NNNNN value but the result is always an error.

 

PS. If you try to continue the subscription with the zip code error, you can successfull finished it .. the problem is only the "red color" of the input box...!

it's a very singular error...

Link to comment
Share on other sites

Bump... same issue here.  United States.  Deleted validation in BO, but zip shows a red error.  It doesn't affect the actual registration, but is confusing to customers.  DB show null for zip authentication as well.

 

 

Having the exact same issue. United States, with NNNNN in the zip code format field and with the field left empty...

 

Any ideas?

  • Like 1
Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...

If still not working, i found out following:
In address.tpl:

countriesNeedZipCode[{$country.id_country|intval}] = {$country.need_zip_code};

 

passed to validate.js:

var result = window['validate_'+$(that).attr('data-validate')]($(that).val(), countriesNeedZipCode[id_country], countries[id_country]['iso_code']);

countriesNeedZipCode returns a integer while the function expects an patern,

 

so
countriesNeedZipCode[{$country.id_country|intval}] = {$country.need_zip_code};

 

should be:

countriesNeedZipCode[{$country.id_country|intval}] = {$country.zip_code_format};

 

then in validate.js:
if (typeof(countriesNeedZipCode[id_country]) != 'undefined' && typeof(countries[id_country]) != 'undefined') {
countries is always undefined:
 

first thing is if you dont use states its never set:
{if isset($country.states) && $country.contains_states}
        countries[{$country.id_country|intval}] = new Array();
        {foreach from=$country.states item='state' name='states'}
            countries[{$country.id_country|intval}].push({ldelim}'id' : '{$state.id_state}', 'name' : '{$state.name|escape:'htmlall':'UTF-8'}'{rdelim});
        {/foreach}
    {/if}

 

should move:
countries[{$country.id_country|intval}] = new Array();
to above the check for state

Anyway then countries still undefined in my validate.js
Conclusion i fixed all changing:

if (typeof(countriesNeedZipCode[id_country]) != 'undefined' && typeof(countries[id_country]) != 'undefined') {

to:

if (typeof(countriesNeedZipCode[id_country]) != 'undefined') {

 

and

var result = window['validate_'+$(that).attr('data-validate')]($(that).val(), countriesNeedZipCode[id_country], countries[id_country]['iso_code']);

to

var result = window['validate_'+$(that).attr('data-validate')]($(that).val(), countriesNeedZipCode[id_country], '');

 

and adress.tpl:

changed
countriesNeedZipCode[{$country.id_country|intval}] = {$country.need_zip_code};

 

to:

countriesNeedZipCode[{$country.id_country|intval}] = {$country.zip_code_format};

 

Hope this helps someone :)

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

Hello,

 

Question on this: We run shops in the US, Canada and in several countries in Europe. We are having the same faulty validation issue for the US and Canada shops, but not the European ones.

 

After applying the changes from http://forge.prestashop.com/browse/PSCSX-4852 the US and Canada shops are fixed, but now the European shops give the faulty validation error for any location that doesn't have a pattern defined in the BO in Localization > Countries. 

 

Any ideas on how to fix?

 

Thanks in advance.

Link to comment
Share on other sites

Ok, found the issue. On line 125 of validate.js, the pattern assigned when no pattern is defined in the back office is: [a-z 0-9-]+

 

Because the Zip/Postal field gets forced to upper case, the RegExp test on line 139/140 kept failing...no upper cases in the pattern, so consistently found no match. Change it to [a-zA-Z 0-9-]+ so that lines 124 and 125 look like the following should fix the issue:

 

if (typeof(pattern) == 'undefined' || pattern.length == 0)
pattern = '[a-zA-Z 0-9-]+';
 
Posting in case others run into this issue.
  • Like 2
Link to comment
Share on other sites

  • 4 months later...

Hello,

 

Question on this: We run shops in the US, Canada and in several countries in Europe. We are having the same faulty validation issue for the US and Canada shops, but not the European ones.

 

After applying the changes from http://forge.prestashop.com/browse/PSCSX-4852 the US and Canada shops are fixed, but now the European shops give the faulty validation error for any location that doesn't have a pattern defined in the BO in Localization > Countries. 

 

Any ideas on how to fix?

 

Thanks in advance.

 
 
I did as above, but I have a problem with the theme, can anyone help me?
d73527b3e568254b.jpg
 
Link to comment
Share on other sites

×
×
  • Create New...