johnchristy Posted January 30, 2013 Share Posted January 30, 2013 hi Im using latest version of prestashop. I need to remove both phone number/ mobile number from the registration form.its showing an error that i must atleast enter 1 number can anyone guide exactly which files i should edit to get rid of this error? Thanks John Link to comment Share on other sites More sharing options...
ajensen27 Posted January 30, 2013 Share Posted January 30, 2013 In the backend, go to Customers --> Addresses at the bottom of the list there is a button that reads "Set required fields for this section". Make sure the phone number check boxes are unchecked. Now if you want to remove the actual text box's on the front end, that's completely different and will take some theme file modifications. Not sure which one's so I'll let someone else chime in on that one if that's what you need. 1 Link to comment Share on other sites More sharing options...
hxd Posted January 30, 2013 Share Posted January 30, 2013 A phone number is required when a customer adds an address either while configuring their account settings or when checking out. To make it optional you have to modify a file called AddressController.php. Assuming that your PrestaShop is installed directly in the public_html folder on your account, the path to it will be public_html/controllers/front/AddressController.php. In that file comment out the following code: if (Configuration::get('PS_ONE_PHONE_AT_LEAST') && !Tools::getValue('phone') && !Tools::getValue('phone_mobile')) $this->errors[] = Tools::displayError('You must register at least one phone number'); To comment it out put a forward slash and an asterisk at the beginning (e.g. /*if...) and an asterisk and a forward slash at the end (e.g. ..number');*/). The phone fields will still be visible on the address form but they will be optional. The address will be saved if the customer doesn't type a phone numbers, but if they want to, they can specify a number. To remove the phone fields from the address form you need to modify the address.tpl file of the theme that you use. For example, if you use the default theme, the path to the file will be public_html/themes/default/address.tpl. Comment out the code: {if $onr_phone_at_least} <p class="inline-infos required">{l s='You must register at least one phone number'} <sup class="required">*</sup></p> {/if} <p class="text"> <label for="phone">{l s='Home phone'}</label> <input type="text" id="phone" name="phone" value="{if isset($smarty.post.phone)}{$smarty.post.phone}{else}{if isset($address->phone)}{$address->phone}{/if}{/if}" /> </p> <p class="text"> <label for="phone_mobile">{l s='Mobile phone'}</label> <input type="text" id="phone_mobile" name="phone_mobile" value="{if isset($smarty.post.phone_mobile)}{$smarty.post.phone_mobile}{else}{if isset($address->phone_mobile)}{$address->phone_mobile}{/if}{/if}" /> </p> If you want to leave the fields as optional, you can just comment out the first part that displays the text that the fields are required. You can also comment out just the part about the home or mobile phone, if you want to leave just one of the two fields on the address form. Hope this helps. 1 Link to comment Share on other sites More sharing options...
ajensen27 Posted January 30, 2013 Share Posted January 30, 2013 A phone number is required when a customer adds an address either while configuring their account settings or when checking out. To make it optional you have to modify a file called AddressController.php. Assuming that your PrestaShop is installed directly in the public_html folder on your account, the path to it will be public_html/controllers/front/AddressController.php. In that file comment out the following code: if (Configuration::get('PS_ONE_PHONE_AT_LEAST') && !Tools::getValue('phone') && !Tools::getValue('phone_mobile')) $this->errors[] = Tools::displayError('You must register at least one phone number'); To comment it out put a forward slash and an asterisk at the beginning (e.g. /*if...) and an asterisk and a forward slash at the end (e.g. ..number');*/). The phone fields will still be visible on the address form but they will be optional. The address will be saved if the customer doesn't type a phone numbers, but if they want to, they can specify a number. This part is completely unnecessary as these fields can be made optional on the back-end as explained in my earlier post. 1 Link to comment Share on other sites More sharing options...
johnchristy Posted January 31, 2013 Author Share Posted January 31, 2013 A phone number is required when a customer adds an address either while configuring their account settings or when checking out. To make it optional you have to modify a file called AddressController.php. Assuming that your PrestaShop is installed directly in the public_html folder on your account, the path to it will be public_html/controllers/front/AddressController.php. In that file comment out the following code: if (Configuration::get('PS_ONE_PHONE_AT_LEAST') && !Tools::getValue('phone') && !Tools::getValue('phone_mobile')) $this->errors[] = Tools::displayError('You must register at least one phone number'); To comment it out put a forward slash and an asterisk at the beginning (e.g. /*if...) and an asterisk and a forward slash at the end (e.g. ..number');*/). The phone fields will still be visible on the address form but they will be optional. The address will be saved if the customer doesn't type a phone numbers, but if they want to, they can specify a number. To remove the phone fields from the address form you need to modify the address.tpl file of the theme that you use. For example, if you use the default theme, the path to the file will be public_html/themes/default/address.tpl. Comment out the code: {if $onr_phone_at_least} {l s='You must register at least one phone number'} [sup]*[/sup] {/if} {l s='Home phone'} {l s='Mobile phone'} If you want to leave the fields as optional, you can just comment out the first part that displays the text that the fields are required. You can also comment out just the part about the home or mobile phone, if you want to leave just one of the two fields on the address form. Hope this helps. thank you. but i coudlnt find the portion in address.tpl.. you sure its from the latest template? Link to comment Share on other sites More sharing options...
hxd Posted January 31, 2013 Share Posted January 31, 2013 It starts around line 217. Make sure it's address.tpl and not addresses.tpl. 1 Link to comment Share on other sites More sharing options...
johnchristy Posted February 1, 2013 Author Share Posted February 1, 2013 It starts around line 217. Make sure it's address.tpl and not addresses.tpl. Thank you very much Link to comment Share on other sites More sharing options...
nomy Posted March 25, 2013 Share Posted March 25, 2013 Thank you very much Tried all this.. didnt change anything.. Tried all this.. didnt change anything.. although.. Im using instant check out. Link to comment Share on other sites More sharing options...
ajensen27 Posted March 28, 2013 Share Posted March 28, 2013 (edited) Tried all this.. didnt change anything.. although.. Im using instant check out. you need to modify the same code found within order-opc-new-account.tpl Edited March 28, 2013 by ajensen27 (see edit history) 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