This article will guide you to add contact form in your Magento contact page. Since many of you are having problems on why your contact form is not working. Just follow this instruction follows:
Step 1. Adding a Transactional Email
If you are already in your Dashboard, go to System > Transactional Emails
click Add New Template and provide relevant data into important fields such as Template *, Locale *, Template Name *, Template Subject *, and Template Content *.
Template content here:
Name: {{var data.name}} E-mail: {{var data.email}} Telephone: {{var data.telephone}} Comment: {{var data.comment}}
and click Save Template.
Note: This will be the format when your customer is reaching you through your contact form.
Step 2. Adding Information on Contact Under Magento System
Under System > Configuration > General > Contact
You will see this fields below
- Enable Contact Us: Yes
- Send Emails To: [email protected]
- Email Sender: General Contact
-
Important: General Contact settings can be found by following System > Configuration > General > Store Email Addresses
Provide your correct email information such as Sender Name and Sender Email
- Email Template: Template1
Template1 represents the template we created in Step1
Of Course, Click Save Config
Step3. Adding Contact form Block into your page
Go to CMS > Pages > Add New Page
Adding relevant information into important fields..
- Page Title *: Contact Us
- URL Key: contact-us
- Store View: All Store Views (default)
Click Content tab and paste this code
{{block type="core/template" name="contactForm" form_action="/contacts/index/post" template="contacts/form.phtml"}}
Click Save Page
After that you can more or less access your contact page by visiting http://your-site.com/contact-us/
Optional Notes
Some of Magento Templates has a built it function to auto generate Contact Us link in your nav menu, if not, you need to hard code it it order for it to work. As default, you can also directly go to http://your-site.com/contacts/index/
You may also encounter sending error or 404 error when testing email form, you can edit
/public_html/app/design/frontend/base/default/template/contacts/form.phtml
or
/public_html/app/design/frontend/YOURTHEME/default/template/contacts/form.phtml
by changing Form action value to
<form action=”/contacts/index/post/” id=”contactForm” method=”post”>
I hope you will find this article useful. Thank you for visiting.
Hi,
Thank you very much for your support…It’s working perfectly for my site.
great!
Hi Elvin,
Without using an add-on, is there a way to make the Contact form add a number, like a ticketing system? For instance, if we get 5 questions today, can the 1st one be “Contact Form – 1” and #2 be “Contact Form -2” etc., automatically increasing the number each time someone submits one?
Hi Steve!
Thank you for contacting us! Yes, it is possible to create like a ticketing system without using any 3rd party module.
However creating it from scratch requires an ample of time. I suggest to get a reliable module to meet your needs.
About email sequence, why not to accommodate all your web mails using email clients? Outlook, mail app, thunderbird, ect.
Regards,
Elvin D.
Well, I was looking at our Order email, and it has a field that says “Order #{{var_order.increment_id}}…Is it possible to add something like that to the subject line so all it does is find the next sequence?
We currently use Outlook when they come in, but they’re not numbered at all.
So it was in Order Email not in contact us form.
I suggest to prepend the order number code into subject line. Is {{var_order.increment_id}} dynamically working?
Sorry…that code is on the Order Email, but I want something similar on the Contact Form. The {{var_order.increment_id}} works fine on the Order Email subject line. Would something similar work on the Contact Form subject?
Hi Steve,
The easiest way to have sequential prefix of email subject is to find email template, then prepend timestamp(), just check the PHP manual.
The other way is to create database Model and increment the primary ID as submission counter.
Thanks Elvin!
Thanks Elvin,
That was clear and understandable!
Is there any simple way related to this article,
That allows me to add another, Second, Contact template,
to be used in a CMS page IN ADDITION to the usual contact-us page?
thanks,
Koby
I have the same question! Would love to know how to add additional contact forms for different pages.
hi
This is working fine. But when i tried to add one more field and in the front end if i tried to give any date and if you click on submit button
Mail is generating such way that the values are not coming.
For example:
Name: cool
Email: [email protected]
Company Name:
Where i added Company name in form.phtml similarly to “Name” by changing name to Company name
and the ui is fine my issue is that the value is showing empty to my mail id
You may solve this issue when go back to STEP 1.
hi Elv Deza,
this is wasim from india and i would like to know that how to create a custom form in magento like i want to make corporate contact form in a pages so how to do as i am learning a magento application currently so it is highly appreciated to you…more help will be highly appreciated ……………..thanks
This was very easy to follow. Thanks.
How do I control what is displayed on the page after an email has been sent?
Hi i am trying to add a contact form on to the footer which i have done fine but it re directs to contacts/index/post once you fill it in and submit, but i want to stay on the same page as the customer was on in the first place, can you help at all
Hi Charles!
You can do it by using ajax,
see information here at
http://magento.stackexchange.com/questions/38041/dynamic-form-submission-ajax
i did all that , but the contact form still not customized , i dont know why , could there any other code can prevent customization ?