Malemi Posted March 6, 2017 Share Posted March 6, 2017 Hello, I have been reading this being possible on PS 1.6, I would like to get it on PS 1.7, please help. Have been trying this way: 1. Line 189 - classes/Customer.php: 'siret' => array('type' => self::TYPE_STRING, 'validate' => 'isSiret', 'required' => true, 'size' => 60), 2. line 523 - controllers/admin/AdminCustomersController.php: $this->fields_form['input'][] = array( 'type' => 'text', 'label' => $this->trans('SIRET', array(), 'Admin.OrdersCustomers.Feature'), 'name' => 'siret', 'required' => true 3. As signing-in a new user (SIRET code being OK) I get this error: [PrestaShopException] Property Customer->siret is empty at line 915 in file classes/ObjectModel.php 910. } 911. 912. $message = $this->validateField($field, $this->$field); 913. if ($message !== true) { 914. if ($die) { 915. throw new PrestaShopException($message); 916. } 917. return $error_return ? $message : false; 918. } 919. } 920. ObjectModelCore->validateFields - [line 248 - classes/ObjectModel.php] ObjectModelCore->getFields - [line 489 - classes/ObjectModel.php] ObjectModelCore->add - [line 261 - classes/Customer.php] - [2 Arguments] CustomerCore->add - [line 447 - classes/ObjectModel.php] - [2 Arguments] ObjectModelCore->save - [line 189 - classes/form/CustomerPersister.php] CustomerPersisterCore->create - [line 61 - classes/form/CustomerPersister.php] - [2 Arguments] CustomerPersisterCore->save - [line 133 - classes/form/CustomerForm.php] - [3 Arguments] CustomerFormCore->submit - [line 46 - controllers/front/AuthController.php] AuthControllerCore->initContent - [line 201 - classes/controller/Controller.php] ControllerCore->run - [line 366 - classes/Dispatcher.php] DispatcherCore->dispatch - [line 28 - index.php] Thank you Regards Link to comment Share on other sites More sharing options...
Malemi Posted March 8, 2017 Author Share Posted March 8, 2017 Hello, Please, could someone help? I am not able to make a field "required", instead of current "optional", in PS 1.7 sign-in form Thank you :-) Link to comment Share on other sites More sharing options...
Malemi Posted March 9, 2017 Author Share Posted March 9, 2017 (edited) Poor me ! I missed the most important: For anyone interested, I got it this way: /classes > Form > CustomerFormatter.php (sign-in form) $format['siret'] = (new FormField) ->setName('siret') ->setType('text') ->setLabel($this->translator->trans( // Please localize this string with the applicable registration number type in your country. For example : "SIRET" in France and "Código fiscal" in Spain. 'Identification number', [], 'Shop.Forms.Labels' )) ->setRequired(true) ; /classes > Customer.php (for customers accounts page) 'siret' => array('type' => self::TYPE_STRING, 'validate' => 'isSiret', 'required' => true), classes > Validate.php (Switch to a new validation system replacing the default French SIRET) Hope it helps Edited March 9, 2017 by Malemi (see edit history) 1 Link to comment Share on other sites More sharing options...
azmaer Posted November 20, 2017 Share Posted November 20, 2017 prestashop 1.7 got option to change siret to required. But it's not working. Bug reported here: give vote for it, please Link to comment Share on other sites More sharing options...
Malemi Posted November 21, 2017 Author Share Posted November 21, 2017 Hi azmaer, Where do I find the option you mention? Me cannot find it under admin ->localization -> Countries and choosing destination country Let me know, Thank you Link to comment Share on other sites More sharing options...
bloobleq Posted May 15, 2018 Share Posted May 15, 2018 Malemi check it here https://www.prestashop.com/forums/topic/652931-getting-internal-server-error-500-when-setting-phone-field-to-required-in-addresses/#comment-2781263 Link to comment Share on other sites More sharing options...
Luigi Donato Posted April 11, 2019 Share Posted April 11, 2019 On 3/9/2017 at 5:13 PM, Malemi said: Poor me ! I missed the most important: For anyone interested, I got it this way: /classes > Form > CustomerFormatter.php (sign-in form) $format['siret'] = (new FormField) ->setName('siret') ->setType('text') ->setLabel($this->translator->trans( // Please localize this string with the applicable registration number type in your country. For example : "SIRET" in France and "Código fiscal" in Spain. 'Identification number', [], 'Shop.Forms.Labels' )) ->setRequired(true) ; /classes > Customer.php (for customers accounts page) 'siret' => array('type' => self::TYPE_STRING, 'validate' => 'isSiret', 'required' => true), classes > Validate.php (Switch to a new validation system replacing the default French SIRET) Hope it helps Thank you..! You have solved my same problem 😁 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