Adding New Fields in Prestashop Registration Form


When i went to the prestashop forum lots of people wants to know how to add customize  field or New field  in the registration form. Prestashop also doesn’t provide the confirm password field in that password. Here are the solutions for those who looking for the above

A simple javascript code is enough to perform the confirmation password field in the registration page in the prestashop.here the code is

<p class="required password">
<label for="passwd_confirm">{l s='Confirm password'}</label>
<input type="password" class="text" name="passwd_confirm" id="passwd_confirm" />
<sup>*</sup>
</p>
<script type="text/javascript">
$(function(){ldelim}
$("#passwd_confirm").parents("form").submit(function(){ldelim}
if ($('#passwd').attr('value') == $('#passwd_confirm').attr('value'))
return true;
alert("{l s='Yours both passwords filled in do not match.'}");
return false;
{rdelim});
{rdelim});
</script>
Code is to be added in the authentication.tpl file in the theme folder
thats it your done
Coming into the solution of the adding new fields.Here we go we have to edit 3 files in the prestashop to get the new field in the prestashop.
1  authentication.tpl file
2  authentication.php file
3  customer.php file
First file is someting like a display information in the prestashop page(authentication.tpl)
so you have to add the html code for the form field you are going to add in the registration page
Second file is for the validation purpose and also to call the tpl file in the theme directory
Third file is the class file which should be in the class directory in the root folder.Here the actual tables related to the reg page is to be connected by means of sql commands like join, inner join etc
No need to edit if ur using the same table but don’t forget to insert the field in the databse table
Advertisements
About

Working For Cause Not For Applause

Tagged with: , , , , ,
Posted in Prestashop
6 comments on “Adding New Fields in Prestashop Registration Form
  1. Mera says:

    Hi,
    Thank you for the explanation, but i still have some troubles to add a new field il my registration form.
    in my authentication.tpl file, i added this line :

    {l s=’longueur_pour_une_chemise’}

    in my authentication.php file i added this one:

    $_POST[‘longueur_pour_une_chemise’] = $_POST[‘longueur_pour_une_chemise’];

    and in my costumer.php file i added
    $fields[‘longueur_pour_une_chemise’] = pSQL($this->longueur_pour_une_chemise);

    after this changed my registration stopped working, and it looked like all information i put in my new field didn’t register.
    do u have an idea of what went wrong ?
    thank you very much for your help!

  2. Erich says:

    Do you have any insights on how you would add a custom field that had a drop-down set of entries from which to choose? I’m trying to get the customer to specify a mail-stop code for a corporate mail room for a B2B site, and I think it would save us headaches if I could enter the mail-codes correctly for them to select.

  3. Nafees Ur Rehman says:

    Hi,
    Thanks for the article.I found it really helpful,but i think we also have to add html code for the form field in the file
    “prestashop\tools\smarty\compile->cba61ee65dd98204dcb14104444a8980d6329c24.file.authentication.tpl”.
    I dn’t know that this really have to be done or not but it worked for me…
    Regards

    • baz says:

      Hi – have tried to get this to work – only for email confirmation in version 1.4.4 Authentication.tpl now becomes authentication controller and it doesn’t want to work 😦 Any ideas how I can get this to work in new version – thanks, baz

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: