I need to customise the contact form of our magento project, so that there are 2 different forms, one is a basic contact form, the other one is tailored to specific clients, so they both have really different fields. Since both forms will share the same email template (not sure why magento is built like that, you should be able to set new templates in the admin contacts preferences) i want to use some conditionals. I managed to use DEPENDS to only show the relevant fields, but then all white space from the code would appear in the email, which looks really strange. So i decided to code around using IF, thinking this will take care of the blank lines (still have to prove that though).
Please have a look at the below code and let me know if you can see something strange. If i take the conditionals out and use DEPEND on each field, it comes to my inbox just fine, but this will not work:
<!--@subject Submitted Form@-->
<!--@vars {
"var data.name":"Sender Name",
"var data.email":"Sender Email",
"var data.telephone":"Sender Telephone",
"var data.comment":"Comment"
} @-->
{{if data.type}}
Type: {{var data.type}}
Name: {{var data.name2}}
Job Title: {{var data.jobTitle}}
Company: {{var data.company}}
Address: {{var data.address}}
Contact Number: {{var data.contactNumber}}
E-mail: {{var data.email2}}
Telephone: {{var data.telephone}}
Enquiries: {{var data.enquiries}}
{{else}}
Name: {{var data.name}}
E-mail: {{var data.email}}
Comment: {{var data.comment}}
{{/if}}
Can you spot something weird? I can get the email in the ELSE branch, so it looks like the data.type is not getting through? The data.type should work, as it comes for a select in the form:
<select name="type">
<option value="">Select...</option>
<option value="Hotelier">I am a Hotelier</option>
<option value="Retail Customer">I am a Retail Customer</option>
</select>
Any ideas?