A Real Magento Contact Page
By default Magento has a very boring contact page that contains no company info. To remedy this for my clients I have been creating a static block where they can enter their contact information such as mailing address and phone numbers as well as adding images and any messages they would like.
This is my solution.
Here’s a working example to check out: Contact PIR Tactical
To make this work we will be modifying the contacts.xml layout file to get the static block and then creating the static block under cms – static blocks in the admin.
Edit Magento Layout XML File
First, open the contacts.xml file located in app/design/frontend/default/YourTheme/layout/contacts.xml I have been adding a cms static block named “contact-info” to the contact page layout so it appears above the contact form.
<reference name="content"> <block type="cms/block" name="contact-info"> <action method="setBlockId"><block_id>contact-info</block_id></action> </block> </reference>
Save the new contacts.xml file and upload to your server.
Add CMS Static Block
Now log into your Magento Admin and go to CMS – Static Blocks. Choose “Add New Block” Name the block “Contact Info” and set the identifier to “contact-info” and then enable the block. You can now enter any html you wish to your contact page above the contact form. No reason you can’t add more information below the form using the same technique.







August 12th, 2009 at 7:21 am
I’ve tried creating the static block reference in the contacts.xml file and then creating the static block. When I reference the static blog in a CMS page it just gives me the html that preceeds the contact form and no contact form. It’s seems simple enough, but I’m not sure why the form is being included.
August 23rd, 2009 at 11:55 am
Hunter- This code is to place a static block of custom text and/or images on your contact page. It is not meant to place the contact form on a cms page.
To add a contact form on a cms page try inserting this code:
{{block type=”core/template” name=”contactForm” template=”contacts/form.phtml”}}
October 20th, 2009 at 4:35 pm
This was a great example and it worked as advertised. Thank you. This actually clarified a process that the Magento site did a poor job of explaining.
March 29th, 2010 at 5:16 am
Thanks for this tip but where do you put that code in the contact.xml file?
March 29th, 2010 at 10:47 am
Look for the contactForm block and put the code before it. You can also place the code after the contactForm block to have your info appear after the form. It should look something like this:
< reference name="content" > < block type="cms/block" name="contact-info" > < action method="setBlockId" >< block_id>contact-info < /block > < /reference > < reference name="content" > < block type="core/template" name="contactForm" template="contacts/form.phtml"/ > < /reference >You will need to remove the spaces from this snippet before and after the <> symbols.
May 11th, 2010 at 9:43 am
Ken,
Thanks for the simple ‘how to’ for this contact us block. Very helpful.
Barracuda
May 20th, 2010 at 12:50 pm
Thanks, this is a great way to do it.
I cannot get that adding a contact form to a page to work in Magento Magento ver. 1.4.0.1, so I resorted to this example.
{{block type=”core/template” name=”contactForm” template=”contacts/form.phtml”}}
May 20th, 2010 at 1:41 pm
I’m just starting a site with Magento ver 1.4.0.1 so I will update things here soon!