Add New Field to Magento Contact Form

Home / Magento / Add New Field to Magento Contact Form

In magento default contact us form provide only four fileds information like Name, Email, Telephone and comment but some time need to more information for contact form it’s depends on bussiness model and criteria. If you want to add new field or need more inforation about the user from contact us so this artical to be helpfull to you.

Below are the step

how to add new field in magento contact us form.

This example to show you how to add extra input type field in magento contact us form.

Step 1: Add field to phtml file

Go to app -> design -> frontend -> yourpackage -> yourtheme -> template -> contacts -> form.phtml

If you want to add required field:

<li>
	<label for="email"><em>*</em><?php echo Mage::helper('contacts')->__('Company Name') ?></label>
	<div class="input-box"><input name="company" id="company" title="<?php echo Mage::helper('contacts')->__('Company Name') ?>" class="input-text required-entry validate-email" type="text" /></div>
</li>

If you want to add non-required field:

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

Magento Contact us Form

Step 2: Add new field detail in email

Open admin panel and go to System -> Transactional E-mails -> Add New Template
Then From the ‘Template’ dropdown menu choose ‘Contact Form’ and then click on ‘Load Template’. You’ll see the current email content, so you’ll simply need to add your new piece of data:

Name: {{var data.name}}
E-mail: {{var data.email}}
Telephone: {{var data.telephone}}

Company Name: {{var data.company}}

Comment: {{var data.comment}}

Magento Contact Form Template

Step 3: Apply nwe template to contact email

Go to System -> Configuration -> Contacts. In the ‘Email Options’ section, choose your new template under the ‘Email Template’ dropdown menu and save.

Contactus Form Magento

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *