====== Add fields to contact form ======
Step One:
Modify the (interface)/(theme)/templates/contacts/form.phtml file.
Say we would like to add a field called ‘Test’ in between e-mail and telephone on the default field.
Here is the current code:
Here is the new field:
I literally just copied the telephone input code and changed the titles. The reason this is important is that it doesn’t matter to Magento what is here because the function on the backend is written such that it will take whatever values are posted to it and send that out via the transactional e-mail form that you create.
Step Two:
Create the new Transactional E-Mail form.
1) Go to System->Transactional E-mails in the Magento Admin section.
2) Click ‘Add New Template’
3) From the ‘Template’ dropdown box select ‘Contact Form’
4) Click ‘Load Template’
5) Under template content you will see:
Name: {{var data.name}}
E-mail: {{var data.email}}
Telephone: {{var data.telephone}}
Comment: {{var data.comment}}
Add your new field in between E-mail and Telephone:
Name: {{var data.name}}
E-mail: {{var data.email}}
Test: {{var data.test}}
Telephone: {{var data.telephone}}
Comment: {{var data.comment}}
6) Enter a name to save the new form under in the input area of ‘Template Name’ and click ‘Save Template’
7) Go to System->Configuration and select ‘Contacts’ on the left hand menu.
8) Select your newly saved template in the ‘Email Template’ dropdown box.
Your good to go!!
Note: The {{var data.something}} will take whatever is the id value of the input field on your form and output it here in the e-mail.