postnl/postnl-magento1-End-of-life

Zipcode validation per country

Closed this issue · 2 comments

  • [x ] I've verified and I assure that I'm running the latest version of the TIG PostNL Magento extension.

  • Feature request (request for a new functionality)
  • [ x] Bug report (encountered problems with the TIG PostNL Magento extension)
  • Extension support request (request for adding support for a new extension)
  • Other

In het hieronder genoemde bestand wordt altijd ervan uit gegaan dat het geselecteerde land Nederland is. Echter als ik een ander land selecteer, bijvoorbeeld Frankrijk, krijg ik een validatie foutmelding dat de ingevulde postcode niet klopt en dat er nog 2 letters toegevoegd moeten worden. Alleen Frankrijk heeft helemaal geen letters in zijn postcode.

app/design/frontend/base/default/template/TIG/PostNL/address_validation/validate.phtml

Hi @Sil-1993,

The Validations get added to the class 'postnl-validate-postcode' and 'postnl-validate-housenumber'. In the skin/frontend/base/default/js/TIG/PostNL/postcodecheck.js I see the following function on line 349:
changePostcodeCheckDisabledFields: function(countryId)

In this function there is a check "if (countryId == 'NL')". If this equals true, the postnl-validate-postcode and postnl-validate-housenumber gets added. After this, you can see a return statement.

If the check doesn't equal true (countryId is something other than NL), we see a call to the function removeDisabledClasses();

removeDisabledClasses(); seems to remove the postnl validation classes, and should disable the validation messages.

It seems that in your case, the countryId isn't properly being set. Could you try placing a debugger in your Javascript file to confirm if the countryId is something other than NL (your selected country)?

@tig-dennisvanderhammen Thanks for your reply. Also thanks for your nice explanation. It turns out that the function removeDisabledClasses() was never reached because of an JavaScript error. After solving this it does work again.