We offer professional Design/Code Customisation and Website Optimisation Service Request Customisation
  • Status: Suggestion

Ticket #12811 - DNI required problem with italian country (codice fiscale obbligatorio) for P.S. 1.7.4.2

I hope to help someone italian who use P.S. 1.7.4.2
In Italy is required and obligatory for law to required C.F (dni) during creation of new customer account. If you set “Yes” dni for italy in “location→country→italy→dni required?” and you flag dni in customer→adresses in your PS BO when a foreign customer (from all country but not Italy) during a registration Prestashop doesn’t continue with checkout because also for not italian customer require dni but there is not the field to compile because only for Italy you have set “yes” under location→country→ italy. This generate a loop problem.

How you can fix it?

Solution:

You have to put this code:

if ($field === ‘dni’) {

              if ($this-> country-> need_identification_number) {
                  $formField-> setRequired (true); 
              }
          } 

in CustomerAddressFormatter.php in folder ...classes/form

After you have to go on BO customer→adresses and unflag “dni”

In this way you fix the problem and for italian customer Codice fiscale become required and for not italian customer “codice fiscale” field doesn’t appeare and not required.

Because this is a big problem with prestashop I hope to help someone Alysum customer that need this function.

This ticket does not depend on any other tickets.

Marek (marek) 29 Aug 2018, 17:03

Thank you for sharing the solution. Unfortunately, there is no an option to pin your ticket, but I'll give a link to your ticket in case someone will have such problem

Alessandro Borsani (AleBTstudio) 29 Aug 2018, 17:49

Perfect I'm glad to help (is a minimum I can do)

Loading...