Jump to content

Registration Form Phone Number


johnchristy

Recommended Posts

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

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.

  • Like 1
Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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

  • 1 month later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...