Magento 1.9 Contact Us Form – How to Change or Add Field

contact-formmagento-1.9

I have to change a field of my contact form. For example, there is a field "telephone" which I have to replace with "subject" field in the contact us page form. Will anyone please tell me how can I make these changes?

Best Answer

  • Open form.phtml file located at app/design/frontend/default/YOUR_THEME/template/contacts folder.
  • Then find the following lines of code:

**

<li>
    <label for="telephone"><?php echo Mage::helper('contacts')->__('Telephone') ?></label>
    <div class="input-box">
        <input name="telephone" id="telephone" title="<?php echo Mage::helper('contacts')->__('Telephone') ?>" value="" class="input-text" type="text" />
    </div>
</li>

**

and replace it with:

<li>
    <label for="subject"><?php echo Mage::helper('contacts')->__('Subject') ?> <span class="required">*</span></label>
    <div class="input-box">
        <input name="subject" id="subject" title="<?php echo Mage::helper('contacts')->__('Subject') ?>" value="" class="required-entry input-text" type="text"/>
    </div>
</li>
  • Now to show this field in contact us mail login to Admin Panel => System => Transactional Emails and click Add New Template and from the templates drop-down box select Contact Form. Then click on Load Template button.
  • Under template content, find:

Telephone: {{var data.telephone}}

and replace it with:

Subject: {{var data.subject}}

  • Now go to System => Configuration and select Contacts. Then under the Email Options, select your new template under the Email Template drop-down and click on Save Config button.
Related Topic