Littlepants Posted September 20, 2013 Share Posted September 20, 2013 Can anyone tell me how to change the required fields when customer registers. Mine is currently set that mobile phone is a required field. Some people don't even have one, and I'm sure I saw a way somewhere to change these, but can't find it now - sorry! Link to comment Share on other sites More sharing options...
Arnel Posted September 21, 2013 Share Posted September 21, 2013 Hello Littlepants, it took a little digging, but I did find a good article on this through Stackoverflow: http://stackoverflow.com/questions/10320382/how-to-customize-register-and-contact-forms-in-prestashop I hope this helps! Let us know if you were able to use it or not. Regards, Arnel C. Link to comment Share on other sites More sharing options...
Arnel Posted September 21, 2013 Share Posted September 21, 2013 Hello Littlepants, I was looking at this a little further and that article actually references a Prestashop post where this question was solved. Here's that link:http://www.prestashop.com/forums/topic/134877-solved-tutorial-custom-contact-page-forms/ Let us know know how it goes! Arnel C. Link to comment Share on other sites More sharing options...
vekia Posted September 21, 2013 Share Posted September 21, 2013 you can define field as required in classes/Address.php file there is an object definition: public static $definition = array( 'table' => 'address', 'primary' => 'id_address', 'fields' => array( 'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false), 'id_manufacturer' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false), 'id_supplier' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false), 'id_warehouse' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false), 'id_country' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), 'id_state' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId'), 'alias' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 32), 'company' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 64), 'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32), 'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32), 'vat_number' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'), 'address1' => array('type' => self::TYPE_STRING, 'validate' => 'isAddress', 'required' => true, 'size' => 128), 'address2' => array('type' => self::TYPE_STRING, 'validate' => 'isAddress', 'size' => 128), 'postcode' => array('type' => self::TYPE_STRING, 'validate' => 'isPostCode', 'size' => 12), 'city' => array('type' => self::TYPE_STRING, 'validate' => 'isCityName', 'required' => true, 'size' => 64), 'other' => array('type' => self::TYPE_STRING, 'validate' => 'isMessage', 'size' => 300), 'phone' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 32), 'phone_mobile' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 32), 'dni' => array('type' => self::TYPE_STRING, 'validate' => 'isDniLite', 'size' => 16), 'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false), 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat', 'copy_post' => false), 'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat', 'copy_post' => false), ), ); required fields have got required=> true param, just remove it 8 Link to comment Share on other sites More sharing options...
stottycabanas Posted September 21, 2013 Share Posted September 21, 2013 Littlepants, there is a setting in back office Preferences/Customers where you can make it non-mandatory to provide a phone number. Set this to No and the red asterisk won't show next to Mobile phone. However if this is set to Yes, it doesn't seem to work as intended - on 1.5.4.1, at least. The prompt says 'You must register at least one phone number.' and there is also a red asterisk next to Mobile phone. But it doesn't matter what you enter in these phone number fields - you can populate both, one or neither, and it will be accepted! Screenshots attached before & after clicking 'Register' where no phone nos. provided. Vekia, I don't think you can just set phone number(s) to 'required'=>true in the code you posted, because it needs to be governed by the back office setting above. There is logic in /controllers/front/AuthController.php which should check for at least one phone number if the back office setting is Yes. However, as demonstrated above, this doesn't seem to work. Incidentally the thread that arncus links to is not directly relevant - it's about the contact form, not the registration form. Link to comment Share on other sites More sharing options...
vekia Posted September 22, 2013 Share Posted September 22, 2013 you've got right, but the question was also: Can anyone tell me how to change the required fields when customer registers. not each field you can mark as required in back office Link to comment Share on other sites More sharing options...
stottycabanas Posted September 22, 2013 Share Posted September 22, 2013 Agreed Vekia, in most cases it would be necessary to follow your advice. Link to comment Share on other sites More sharing options...
vekia Posted September 23, 2013 Share Posted September 23, 2013 but of course, field related to phone - the correct way to make it required / unrequired - is back office setting exactly as you said @stottycabanas Link to comment Share on other sites More sharing options...
xchriz Posted October 27, 2013 Share Posted October 27, 2013 Littlepants, there is a setting in back office Preferences/Customers where you can make it non-mandatory to provide a phone number. Phones3.JPG Set this to No and the red asterisk won't show next to Mobile phone. However if this is set to Yes, it doesn't seem to work as intended - on 1.5.4.1, at least. The prompt says 'You must register at least one phone number.' and there is also a red asterisk next to Mobile phone. But it doesn't matter what you enter in these phone number fields - you can populate both, one or neither, and it will be accepted! Screenshots attached before & after clicking 'Register' where no phone nos. provided. Phones1.JPGPhones2.JPG Vekia, I don't think you can just set phone number(s) to 'required'=>true in the code you posted, because it needs to be governed by the back office setting above. There is logic in /controllers/front/AuthController.php which should check for at least one phone number if the back office setting is Yes. However, as demonstrated above, this doesn't seem to work. Hi, I've also this problem in PS 1.5.6.0 I think the problem is in /controllers/front/AuthController.php in processSubmitAccount() function $error_phone = false; if (Configuration::get('PS_ONE_PHONE_AT_LEAST')) { if (Tools::isSubmit('submitGuestAccount') || !Tools::getValue('is_new_customer')) { if (!Tools::getValue('phone') && !Tools::getValue('phone_mobile')) $error_phone = true; } elseif (((Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && Configuration::get('PS_ORDER_PROCESS_TYPE')) || (Configuration::get('PS_ORDER_PROCESS_TYPE') && !Tools::getValue('email_create'))) && (!Tools::getValue('phone') && !Tools::getValue('phone_mobile'))) $error_phone = true; elseif (((Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && Configuration::get('PS_ORDER_PROCESS_TYPE') && Tools::getValue('email_create'))) && (!Tools::getValue('phone') && !Tools::getValue('phone_mobile'))) $error_phone = true; } Is there any fix? Chris Link to comment Share on other sites More sharing options...
lock-e73 Posted February 25, 2014 Share Posted February 25, 2014 Hi, I have a query relating to this topic ... I hope! I've purchased the 'Private Shop' module for Prestashop (using PS 1.5.6.2) which allows you to force a login to your shop ... perfect so far. As per normal account creation process, once the account and password is set up you can log in to the site straight away. I'd like to make the password field NOT required and comment it out, therefore forcing a manual password input and completion of the account creation process in the backoffice. I need to assign each user to a group to limit the categories they can see BEFORE they log in and this is the only way I can think of to do that. I've managed to edit authentication.tpl in themes/default to comment out the mandatory password field, but it also needs to be marked as 'false' somewhere else ... and I have no idea where! I'm getting the error: There is 1 error password is required. Please help! Thanks, lock-e73 Link to comment Share on other sites More sharing options...
edoluz Posted April 5, 2014 Share Posted April 5, 2014 Hello everybody. This topic is really helpful for me: in our store we'd like to have the "house number" mandatory because in the address field many of them forget to write in it.... So the carrier has often problems shipping the goods... Do you think we can easily for example edit the "Address 2" field and transform it in a mandatory one? Note for Prestashop Developers: I think we all would appreciate having a tool to edit, add, delete, change the customers fields Thanks! Link to comment Share on other sites More sharing options...
vekia Posted April 5, 2014 Share Posted April 5, 2014 hello in case of "address 2": you mean second address (group of fields) or about simple field, second part of address? what if someone don't have to use it because someone owns short address? what then? Link to comment Share on other sites More sharing options...
edoluz Posted April 5, 2014 Share Posted April 5, 2014 Hello. We need a simple numeric field we should add to address 1. IN Italy we all have a house number... but if someone doesn't have we can for example accept a "0" or a "no"... Link to comment Share on other sites More sharing options...
impesud Posted June 25, 2014 Share Posted June 25, 2014 Hi, I've also this problem in PS 1.5.6.0 I think the problem is in /controllers/front/AuthController.php in processSubmitAccount() function $error_phone = false; if (Configuration::get('PS_ONE_PHONE_AT_LEAST')) { if (Tools::isSubmit('submitGuestAccount') || !Tools::getValue('is_new_customer')) { if (!Tools::getValue('phone') && !Tools::getValue('phone_mobile')) $error_phone = true; } elseif (((Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && Configuration::get('PS_ORDER_PROCESS_TYPE')) || (Configuration::get('PS_ORDER_PROCESS_TYPE') && !Tools::getValue('email_create'))) && (!Tools::getValue('phone') && !Tools::getValue('phone_mobile'))) $error_phone = true; elseif (((Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && Configuration::get('PS_ORDER_PROCESS_TYPE') && Tools::getValue('email_create'))) && (!Tools::getValue('phone') && !Tools::getValue('phone_mobile'))) $error_phone = true; } Is there any fix? Chris Hello to all, I have the same problem and I wanted to kindly know how it can be solved. Is there any fix o limitation di Prestashop? Thank you. Link to comment Share on other sites More sharing options...
happycandle Posted February 5, 2015 Share Posted February 5, 2015 Hey, This is my code from address.php and from some odd reason it still asks me for post code as a required field. Somebody any ideas about this ? public static $definition = array( 'table' => 'address', 'primary' => 'id_address', 'fields' => array( 'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false), 'id_manufacturer' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false), 'id_supplier' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false), 'id_warehouse' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false), 'id_country' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), 'id_state' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId'), 'alias' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 32), 'company' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 64), 'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32), 'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32), 'vat_number' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'), 'address1' => array('type' => self::TYPE_STRING, 'validate' => 'isAddress', 'required' => true, 'size' => 128), 'address2' => array('type' => self::TYPE_STRING, 'validate' => 'isAddress', 'size' => 128), 'postcode' => array('type' => self::TYPE_STRING, 'validate' => 'isPostCode', 'size' => 12), 'city' => array('type' => self::TYPE_STRING, 'validate' => 'isCityName', 'required' => true, 'size' => 64), 'other' => array('type' => self::TYPE_STRING, 'validate' => 'isMessage', 'size' => 300), 'phone' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 32), 'phone_mobile' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 32), 'dni' => array('type' => self::TYPE_STRING, 'validate' => 'isDniLite', 'size' => 16), 'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false), 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat', 'copy_post' => false), 'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat', 'copy_post' => false), ), ); Link to comment Share on other sites More sharing options...
happycandle Posted February 5, 2015 Share Posted February 5, 2015 I figure it out. It is a backoffice feature on the localization tab thanks Link to comment Share on other sites More sharing options...
Docki Posted March 17, 2016 Share Posted March 17, 2016 Hello, I have just found out that the required fields in the checkout page can also be edited by the " Set required fields for this section" found in back office at Customers>Adresses Hope it helps 2 Link to comment Share on other sites More sharing options...
Recommended Posts