ECommerce Insights Blog

Stay on top of it all and get ahead with useful articles, how-tos, tips and tricks on e-commerce.

How To Append Additional Fields In Magento’s Default Contact Form?

Product Grid Page with Options & Layered Navigation

Magento itself provides a lean Contact Us form which can be used by customers to contact the store owners. But, what if you want to take additional inputs from your user? Customizing Magento Contact Us form is one of the most common request any Magento developer recives. So, here is an easy way of appending/inserting more fields to customize Magento Contact form.

Step 1. Edit form.phtml file located at app/design/frontend/default/YOUR_THEME/template/contacts/form.phtml. Suppose you want to add subject field after telephone. Then find the following lines of code

  • And just add the following code to add subject as a new field in the contact us form

  • Step 2. Now to show this field in contact us mail login to Admin Panel => System => Transactional E-mails and click Add New Template and from the Template drop-down box select Contact Form then Load Template. Under template content you will see a piece of code like this:

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

    You can add your new field Subject after Telephone : {{var data.telephone}} like this:

    Name: {{var data.name}}
    E-mail: {{var data.email}}
    Telephone: {{var data.telephone}}
    Subject: {{var data.subject}}
    Comment: {{var data.comment}}
    

    Then enter the template name and click on Save Template.

    Step 3. Now the final step is to 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.

    Similarly, you can add any numbers of fields in your Magento’s default Contact Form.

    Please leave us a comment and share your experiences of customizing Magento’s default Contact form with us.