Magento – Add fields to default Contact Form
- Edit form.phtml that is located on “
app/design/frontend/default/YOUR_THEME/template/contacts/form.phtml"
- Find the following line 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 add the new field
<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 go to Admin panel, under “Admin Panel => System => Transactional E-mails”, click “add new template”, and from the “template” drop-down, select “Contact Form” and “Load template”, Under Template content you eill see :
Name: {{var data.name}} E-mail: {{var data.email}} Telephone: {{var data.telephone}} Comment: {{var data.comment}}
- Now you can add your new fields where you need.
- Then add your template name and click “save”
- Now go under “System- Configuration”, and select “Contacts”, Under the ” e-mail options ” drop-down, select you template and save.