periwinkle_fr Posted December 16, 2020 Share Posted December 16, 2020 (edited) There is no way to override the validation regex mask provided in the src/Core/Domain/Customer/ValueObject/FistName.php and src/Core/Domain/Customer/ValueObject/lastName.php files. Some people advised to alter those files : but, it's not a good idea because changes could be overwrited in case of core update. Instead of that, the validation process should use the Validate::isCustomerName() function to check is the field is valid or not. I tryed to do it without altering the core by overriding the service "prestashop.core.form.identifiable_object.data_handler.customer_form_data_handler" like this https://devdocs.prestashop.com/1.7/modules/concepts/services/ Changing AddCustomerCommand class, EditCustomerCommand class, and finally FirstName and LastName classes It worked for the frontend but crashes the Backend with this error : Attempted to load class "CustomerFormDataHandler" from namespace "Pwk\PwkCustomer". Did you forget a "use" statement for "PrestaShop\PrestaShop\Core\Form\IdentifiableObject\DataHandler\CustomerFormDataHandler"? Is there a way to manage this ? Or an update of these classes should be possible Simply changing $matchesFirstNamePattern = preg_match('/^[¤|]*$/u', stripslashes($firstName)); by $matchesFirstNamePattern = \Validate::isCustomerName($firstName)); Best regards, Edited December 16, 2020 by periwinkle_fr I forgot the \ before \Validate in order to make it work. (see edit history) Link to comment Share on other sites More sharing options...
Mediacom87 Posted December 16, 2020 Share Posted December 16, 2020 Bonjour, merci de parler en français dans la section française. 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