AttackFromNowhere Posted July 2, 2018 Share Posted July 2, 2018 Hello, I'd like to add a password confirm field on registration page. I use PS 1.7. Could you please help me guys ? Thank you :-) Link to comment Share on other sites More sharing options...
ENS Enterprises Posted July 3, 2018 Share Posted July 3, 2018 Please check below link https://www.prestashop.com/forums/topic/544830-solved-how-to-add-password-confirm-field/ Thanks Link to comment Share on other sites More sharing options...
AttackFromNowhere Posted July 3, 2018 Author Share Posted July 3, 2018 1 minute ago, ENS Enterprises said: Please check below link https://www.prestashop.com/forums/topic/544830-solved-how-to-add-password-confirm-field/ Thanks Thank you but i already saw this. It's a solution for Prestashop 1.6 and I'm under 1.7 :-) Link to comment Share on other sites More sharing options...
ENS Enterprises Posted July 3, 2018 Share Posted July 3, 2018 ok, let me do that and share the code. Link to comment Share on other sites More sharing options...
AttackFromNowhere Posted July 4, 2018 Author Share Posted July 4, 2018 On 03/07/2018 at 9:38 AM, ENS Enterprises said: ok, let me do that and share the code. Are you serious ? It would be so cool :-) Link to comment Share on other sites More sharing options...
sahar12 Posted March 14, 2019 Share Posted March 14, 2019 Please, if anyone have a solution using PS 1.7.5.0. , could you help me? Link to comment Share on other sites More sharing options...
mma87 Posted April 18, 2019 Share Posted April 18, 2019 Hello, I'm using PS 1.7.5.1 and I made a customization to insert email and password confirmation: BACKUP FIRST!! Download those 2 files /classes/form/CustomerFormatter.php /classes/form/CustomerForm.php open the file CustomerFormatter.php and search $format['email'] = (new FormField()) paste above $format['email'] = (new FormField()) ->setName('email') ->setType('email') ->setLabel( $this->translator->trans( 'Email', [], 'Shop.Forms.Labels' ) ) ->setRequired(true) ; this code: $format['conf_email'] = (new FormField) ->setName('conf_email') ->setLabel( $this->translator->trans( 'Confirm e-mail', [], 'Shop.Forms.Labels' ) ) ->setRequired(true) ; Then after: if ($this->ask_for_new_password) { $format['new_password'] = (new FormField()) ->setName('new_password') ->setType('password') ->setLabel( $this->translator->trans( 'New password', [], 'Shop.Forms.Labels' ) ) ; } paste this code: $format['conf_password'] = (new FormField) ->setName('conf_password') ->setType('password') ->setLabel( $this->translator->trans( 'Confirm password', [], 'Shop.Forms.Labels' ) ) ->setRequired(true) ; Now open CustomerForm.php and search public function validate() after this code: $emailField = $this->getField('email'); $id_customer = Customer::customerExists($emailField->getValue(), true, true); $customer = $this->getCustomer(); if ($id_customer && $id_customer != $customer->id) { $emailField->addError($this->translator->trans( 'The email is already used, please choose another one or sign in', array(), 'Shop.Notifications.Error' )); } Paste the following code: //Confirm Email - check if is the same $confEmailField = $this->getField('conf_email'); $emailValue = $emailField->getValue(); $confEmailValue = $confEmailField->getValue(); if ($emailValue != $confEmailValue) { $confEmailField->addError($this->translator->trans( "The email and the confirmation email don't match", array(), 'Shop.Notifications.Error' )); } //Confirm password - check if is the same $passwField = $this->getField('password'); $confPasswField = $this->getField('conf_password'); $passwordValue = $passwField->getValue(); $confPasswValue = $confPasswField->getValue(); if ($passwordValue != $confPasswValue) { $confPasswField->addError($this->translator->trans( "The password and the confirmation password don't match", array(), 'Shop.Notifications.Error' )); } Now upload those 2 files in: /override/classes/form/ Clear the cache That's it! Link to comment Share on other sites More sharing options...
stevent Posted April 25, 2019 Share Posted April 25, 2019 Top that work ! Thank you Link to comment Share on other sites More sharing options...
mma87 Posted April 28, 2019 Share Posted April 28, 2019 you're welcome! Link to comment Share on other sites More sharing options...
Marksaa Posted June 18, 2019 Share Posted June 18, 2019 (edited) works perfectly except for translations. I used default catalogue translations (all translated already) but there is no any appropriate translation for "The email and the confirmation email don't match", it should be added to translations, can somebody help us to solve this problem, or did i miss something? Prestashop 1.7.2.1 Edited June 18, 2019 by Marksaa (see edit history) Link to comment Share on other sites More sharing options...
amorxoigel Posted June 28, 2019 Share Posted June 28, 2019 (edited) On 4/18/2019 at 6:53 PM, mma87 said: Hello, I'm using PS 1.7.5.1 and I made a customization to insert email and password confirmation: BACKUP FIRST!! Download those 2 files /classes/form/CustomerFormatter.php /classes/form/CustomerForm.php open the file CustomerFormatter.php and search $format['email'] = (new FormField()) paste above $format['email'] = (new FormField()) ->setName('email') ->setType('email') ->setLabel( $this->translator->trans( 'Email', [], 'Shop.Forms.Labels' ) ) ->setRequired(true) ; this code: $format['conf_email'] = (new FormField) ->setName('conf_email') ->setLabel( $this->translator->trans( 'Confirm e-mail', [], 'Shop.Forms.Labels' ) ) ->setRequired(true) ; Then after: if ($this->ask_for_new_password) { $format['new_password'] = (new FormField()) ->setName('new_password') ->setType('password') ->setLabel( $this->translator->trans( 'New password', [], 'Shop.Forms.Labels' ) ) ; } paste this code: $format['conf_password'] = (new FormField) ->setName('conf_password') ->setType('password') ->setLabel( $this->translator->trans( 'Confirm password', [], 'Shop.Forms.Labels' ) ) ->setRequired(true) ; Now open CustomerForm.php and search public function validate() after this code: $emailField = $this->getField('email'); $id_customer = Customer::customerExists($emailField->getValue(), true, true); $customer = $this->getCustomer(); if ($id_customer && $id_customer != $customer->id) { $emailField->addError($this->translator->trans( 'The email is already used, please choose another one or sign in', array(), 'Shop.Notifications.Error' )); } Paste the following code: //Confirm Email - check if is the same $confEmailField = $this->getField('conf_email'); $emailValue = $emailField->getValue(); $confEmailValue = $confEmailField->getValue(); if ($emailValue != $confEmailValue) { $confEmailField->addError($this->translator->trans( "The email and the confirmation email don't match", array(), 'Shop.Notifications.Error' )); } //Confirm password - check if is the same $passwField = $this->getField('password'); $confPasswField = $this->getField('conf_password'); $passwordValue = $passwField->getValue(); $confPasswValue = $confPasswField->getValue(); if ($passwordValue != $confPasswValue) { $confPasswField->addError($this->translator->trans( "The password and the confirmation password don't match", array(), 'Shop.Notifications.Error' )); } Now upload those 2 files in: /override/classes/form/ Clear the cache That's it! ty for ur solution but still it give me an error " Parse error: syntax error, unexpected '$emailValue' (T_VARIABLE) " on CustomerForm.php Any ideas how to solve it? prestashop 1.7.5 Edited June 28, 2019 by legioxroma mistake. (see edit history) Link to comment Share on other sites More sharing options...
amorxoigel Posted June 28, 2019 Share Posted June 28, 2019 (edited) double mexages Edited June 28, 2019 by legioxroma mistake (see edit history) Link to comment Share on other sites More sharing options...
zslh Posted June 30, 2019 Share Posted June 30, 2019 Well it works, but I cannot translate those labels. I don't find it under translations. Link to comment Share on other sites More sharing options...
miographix Posted October 8, 2019 Share Posted October 8, 2019 Just applied your code and it works well so far. But I also don't find where to set some translations. Any idea? Thanks! Link to comment Share on other sites More sharing options...
miographix Posted January 10, 2020 Share Posted January 10, 2020 Hello, I once used that code and it works well. But now I found out that it is not possible to have guest orders in the shop because if password confirmation field is not filled a message to fill it appears. How to achieve that both fileds - password and password confirmation - are optional? So thet it is also possible to order as guest without opning an account? Thanks in advance! Link to comment Share on other sites More sharing options...
thehurricane Posted February 5, 2020 Share Posted February 5, 2020 On 1/10/2020 at 4:07 PM, miographix said: Hello, I once used that code and it works well. But now I found out that it is not possible to have guest orders in the shop because if password confirmation field is not filled a message to fill it appears. How to achieve that both fileds - password and password confirmation - are optional? So thet it is also possible to order as guest without opning an account? Thanks in advance! Yeah thats true, anyone find a solution? Link to comment Share on other sites More sharing options...
miographix Posted February 5, 2020 Share Posted February 5, 2020 My solution was to change ">setRequired(true)" in CustomerFormatter.php to ">setRequired(false)". But only for the confirmation field! 1 Link to comment Share on other sites More sharing options...
thehurricane Posted February 5, 2020 Share Posted February 5, 2020 14 minutes ago, miographix said: My solution was to change ">setRequired(true)" in CustomerFormatter.php to ">setRequired(false)". But only for the confirmation field! works great, thank You! Link to comment Share on other sites More sharing options...
miographix Posted February 5, 2020 Share Posted February 5, 2020 You are welcome! Link to comment Share on other sites More sharing options...
fjratelier Posted April 29, 2020 Share Posted April 29, 2020 Hello, for me it also works very well in the PS 1.7.6.2 version. Thanks mma87!! Unfortunately, like the others, I have the problem with the translation in other languages. Has anyone found a solution? Thank you. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now