5ummer5 Posted December 13, 2010 Share Posted December 13, 2010 Hi all,I saw something about his on another topic and was looking for more than the quick fix solution. Although the existing Mr and Ms options are really only to gather the gender of the customer, some (from research in the UK) would find it odd that they were only given the options of Mr and Ms. To resolve this the quick fix would be to edit the text of the label to read "Ms, Mrs, Miss". Although this may be sufficient for some I wanted the user to be able to select their own title.Below is how to do it!PLEASE backup the files before editing. I have tested this on v.1.3.3 only, however it may work for previous versions.To do this I edited the identity.tpl and authentication.tpl files located in the template directory. Find the code: <input type="radio" name="id_gender" id="id_gender1" value="1" {if isset($smarty.post.id_gender) && $smarty.post.id_gender == 1}checked="checked"{/if} /> {l s='Mr.'} <input type="radio" name="id_gender" id="id_gender2" value="2" {if isset($smarty.post.id_gender) && $smarty.post.id_gender == 2}checked="checked"{/if} /> {l s='Ms.'} and replace with <input type="radio" name="id_gender" id="id_gender1" value="1" {if isset($smarty.post.id_gender) && $smarty.post.id_gender == 1}checked="checked"{/if} /> {l s='Mr'} <input type="radio" name="id_gender" id="id_gender2" value="2" {if isset($smarty.post.id_gender) && $smarty.post.id_gender == 2}checked="checked"{/if} /> {l s='Ms'} <input type="radio" name="id_gender" id="id_gender3" value="3" {if isset($smarty.post.id_gender) && $smarty.post.id_gender == 3}checked="checked"{/if} /> {l s='Miss'} <input type="radio" name="id_gender" id="id_gender4" value="4" {if isset($smarty.post.id_gender) && $smarty.post.id_gender == 4}checked="checked"{/if} /> {l s='Mrs'} This way they can select their proper title. Edit authentication.tpl then it changes the registration form. Edit identity.tpl to change the "My Personal Info" form.Once this is done if you check in the BO under the customers tab you will see that rather than the male/female symbol there will be a question mark as the values for the 2 new titles we have added are not recognised as a gender. To change this you will need to edit the core code in the AdminCustomers.php file. This is located in YOURADMINFOLDER/Tabs. On or around line 38 if you scroll across you will see a piece of code which says array(1 => 'male.gif', 2 => 'female.gif', 'default' => 'unknown.gif'), Change this to array(1 => 'male.gif', 2 => 'female.gif', 3 => 'female.gif', 4 => 'female.gif', 'default' => 'unknown.gif'), We have now specified to treat the two new titles (with the values of 3 and 4) as the female gender. This will then display the correct symbol in the BO!I hope you found this helpful! Any questions just ask! Link to comment Share on other sites More sharing options...
joenineo Posted May 4, 2011 Share Posted May 4, 2011 You may also consider adding it toorder-opc-new-account.tpl Link to comment Share on other sites More sharing options...
pepperoni Posted May 21, 2011 Share Posted May 21, 2011 That was a very useful post. I needed to add "Mrs" and "Miss”. Great!Also I’m looking a way to add a radio option of "Other" at the end. When the user selects it to have a text box to write Dr or whatever else.Has anyone ever needed the same thing? Any solutions?Thank you Link to comment Share on other sites More sharing options...
Koinonos Posted October 3, 2011 Share Posted October 3, 2011 Hi I tried the code changes suggested today on a new install, but when customers register they only have the option Mr or Ms. In the BO Customers, the dropdown now shows M, F, F, F, F, ? I updated identity.tplAdminCustomers.php order-opc-new-account.tpl and authentication.tpl Do any other files need updating? Thank you. Link to comment Share on other sites More sharing options...
senses Posted January 20, 2012 Share Posted January 20, 2012 If this is applied to an existing site will it not mess up the database fields ? Link to comment Share on other sites More sharing options...
exportc Posted August 1, 2012 Share Posted August 1, 2012 (edited) I'm using PrestaShop 1.4.8.2, and found that the BO wasn't selecting the new fields for me. So, another thing I did was to also edit, somewhere around line 686 of the AdminCustomers.php file, located in YOURADMINFOLDER/Tabs (provided by 5ummer5 above). In my case, I needed to add fields for Mrs. and Dr. to the registration form. This is also a great option for those who may want to display a field, such as "Other" in the BO as well (if you've already modified the fields in the pages/areas given by 5summer5). So, in addition to the suggestions given above, I also changed the following code from: <input type="radio" size="33" name="id_gender" id="gender_1" value="1" '.($this->getFieldValue($obj, 'id_gender') == 1 ? 'checked="checked" ' : '').'/> <label class="t" for="gender_1"> '.$this->l('Male').'</label> <input type="radio" size="33" name="id_gender" id="gender_2" value="2" '.($this->getFieldValue($obj, 'id_gender') == 2 ? 'checked="checked" ' : '').'/> <label class="t" for="gender_2"> '.$this->l('Female').'</label> <input type="radio" size="33" name="id_gender" id="gender_3" value="9" '.(($this->getFieldValue($obj, 'id_gender') == 9 OR !$this->getFieldValue($obj, 'id_gender')) ? 'checked="checked" ' : '').'/> <label class="t" for="gender_3"> '.$this->l('Unknown').'</label> To this: <input type="radio" size="33" name="id_gender" id="gender_1" value="1" '.($this->getFieldValue($obj, 'id_gender') == 1 ? 'checked="checked" ' : '').'/> <label class="t" for="gender_1"> '.$this->l('Male').'</label> <input type="radio" size="33" name="id_gender" id="gender_2" value="2" '.($this->getFieldValue($obj, 'id_gender') == 2 ? 'checked="checked" ' : '').'/> <label class="t" for="gender_2"> '.$this->l('Female').'</label> <input type="radio" size="33" name="id_gender" id="gender_3" value="3" '.($this->getFieldValue($obj, 'id_gender') == 3 ? 'checked="checked" ' : '').'/> <label class="t" for="gender_3"> '.$this->l('Mrs.').'</label> <input type="radio" size="33" name="id_gender" id="gender_4" value="4" '.($this->getFieldValue($obj, 'id_gender') == 4 ? 'checked="checked" ' : '').'/> <label class="t" for="gender_4"> '.$this->l('Dr.').'</label> <input type="radio" size="33" name="id_gender" id="gender_5" value="9" '.(($this->getFieldValue($obj, 'id_gender') == 9 OR !$this->getFieldValue($obj, 'id_gender')) ? 'checked="checked" ' : '').'/> <label class="t" for="gender_5"> '.$this->l('Unknown').'</label> Hope this helps someone who may be looking for a similar solution. Edited August 1, 2012 by exportc (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