periwinkle_fr Posted December 15, 2022 Share Posted December 15, 2022 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. Or for any ValueObject ? 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, 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