Magento - Adding Fields to the Contact Form

Standard contact form not meeting your requirements? Here's how to make some changes...

 

Magento Developer Perth

 

If the standard contact form in Magento doesn't fit your requirements, making some changes is thankfully not too difficult.

Open /app/design/frontend/default/<your_theme>/template/contacts/form.phtml

If that file doesn't exist, copy it from the base package (/app/design/frontend/base/default/template/contacts/form.phtml) and save it to your theme.

You will see the form in there and can easily add new fields or content.

Additionally, you could include code from other blocks by adjusting the layout file (/app/design/frontend/default/<your_theme>/layout/contacts.xml)

Finally, you will want the information to be sent in the email of course. To do that, in your admin panel go to System > Transactional Emails.

If you don't see the Contact Form template there, click on New Template.

Where it says Load Default Template, select Contact Form from the drop down list and load it. Then, make the changes to the template using the field ID to get the data. For example, the value for the name field will be displayed when using:

{{var data.name}}

Format the form (get it? :D) as you need and hey presto, all up and running :)