Rename the Middle Name/Initial to Father's Name
-
22-01-2021 - |
Question
I need to rename the field of Middle Name/Initial in my registration form: https://www.khouryhome.com/customer/account/create/ to Father's name and want to make it mandatory and not optional like it is now in the system-->customer configuration. Thanks in advance for the help.
<div class="field name-middlename">
<label for="<?php echo $this->getFieldId('middlename')?>" class="required"><?php echo $this->getStoreLabel('middlename'); ?> FATHER NAME <em>*</em></label>
<div class="input-box">
<input type="text" id="<?php echo $this->getFieldId('middlename')?>" name="<?php echo $this->getFieldName('middlename')?>" value="<?php echo $this->escapeHtml($this->getObject()->getMiddlename()) ?>" title="<?php echo $this->getStoreLabel('middlename') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('middlename') ?>" <?php echo $this->getFieldParams() ?> />
</div>
</div>
this is for the first name:
<div class="field name-firstname">
<label for="<?php echo $this->getFieldId('firstname')?>" class="required"><em>*</em><?php echo $this->getStoreLabel('firstname') ?></label>
<div class="input-box">
<input type="text" id="<?php echo $this->getFieldId('firstname')?>" name="<?php echo $this->getFieldName('firstname')?>" value="<?php echo $this->escapeHtml($this->getObject()->getFirstname()) ?>" title="<?php echo $this->getStoreLabel('firstname') ?>" maxlength="255" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('firstname') ?>" <?php echo $this->getFieldParams() ?> />
</div>
</div>
Solution
Copy the following file:
app/design/frontend/base/default/template/customer/widget/name.phtml
to your theme like below:
app/design/frontend/[your_package]/[your_theme]/customer/widget/name.phtml
And change the text.
For make it required from database:
Goto eav_attribute table and find the middlename attribute code and change the field is_required to 1.
Also from here you can change the Text of Middle name to Father's name as well.
Change the following in name.phtml:
<div class="field name-middlename">
<label for="<?php echo $this->getFieldId('middlename')?>" class="required">FATHER NAME <em>*</em></label>
<div class="input-box">
<input type="text" id="<?php echo $this->getFieldId('middlename')?>" name="<?php echo $this->getFieldName('middlename')?>" value="<?php echo $this->escapeHtml($this->getObject()->getMiddlename()) ?>" title="<?php echo $this->getStoreLabel('middlename') ?>" class="input-text required-entry<?php echo $this->helper('customer/address')->getAttributeValidationClass('middlename') ?>" <?php echo $this->getFieldParams() ?> />
</div>
</div>