How to- make phone field required at registration.

by John on Nov.06, 2009, under Hints/Tips/Hacks

Some users may need to have the phone number field required for new registrations. This is quite simple and needs you to edit 2 files on your server. Address.php which is located in your classes folder, and also the authentication.tpl file wich is located in your theme folder.

First the Address.php file. Find the the following line of code:

protected $fieldsRequired = array('id_country', 'alias', 'lastname', 'firstname', 'address1', 'postcode', 'city');

and change it to:

protected $fieldsRequired = array('id_country', 'alias', 'lastname', 'firstname', 'address1', 'postcode', 'city', 'phone');

In the authentication.tpl file find the following code:

<p class="text">
<label for="phone">{l s='Home phone'}
<input type="text" class="text" name="phone" id="phone" value="{if isset($smarty.post.phone)}{$smarty.post.phone}{/if}" />
</p>

and change it to:

<p class="required text">
<label for="phone">{l s='Home phone'}
<input type="text" class="text" name="phone" id="phone" value="{if isset($smarty.post.phone)}{$smarty.post.phone}{/if}" />
<sup>*</sup>
</p>

This second section of code adds the astrix to show that the field is required.

You could use the above example to make any of the fields required in your registration process. Just look for the different sections in the authentication.tpl file and add the <sup>*</sup>.

VN:F [1.9.3_1094]
Rating: 4.2/5 (5 votes cast)
How to- make phone field required at registration., 4.2 out of 5 based on 5 ratings
Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • MisterWong
  • Reddit
  • StumbleUpon
  • Twitter
  • Add to favorites
  • RSS
  • Technorati

Related posts:

  1. Home Featured Carousel Module v0.1
  2. Pay by Phone Module
  3. Change sub-categories to grid view
  4. Alter Prestashop to UK address format (1.3.1)

:

Leave a Reply

Popular tags