Menu
Web Design | SEO | Website Development

UK Based Web Agency, Magento & Wordpress Specialist (Cranleigh | Surrey)

How to add Static Blocks to a Magento Contact Page

By In Advice, Platforms, Website Development On 13/03/2012


Adding Static Block to your standard Magento contact page is very useful (I usually make 1 above the form and 1 below.)… Simply follow these instructions:

  • Make your static blocks in Magento, I called mine contact_form_abovecontact_form_below (in Backend | CMS | Static Blocks).
  • Find your contact.xml file – usually it’s in: public_html/app/design/frontend/default/YOUR-TEMPLATE/layout/
  • Add the following code for each block in the <reference name=”content”> area.
<block type="cms/block" name="YOURSTATICBLOCKNAME">
<action method="setBlockId"><block_id>contact_form_above</block_id></action>
</block>
  • Save, & don’t forget to cache refresh (Backend | System | Cache Management).
  • For reference here’s the code for a contact page showing a static block above and below the contact form…
<layout version="0.1.0">
<default>
<reference name="footer_links">
<action method="addLink" translate="label title" module="contacts" ifconfig="contacts/contacts/enabled"><label>Contact Us</label><url>contacts</url><title>Contact Us</title><prepare>true</prepare></action>
</reference>
</default>

<contacts_index_index translate="label">
<label>Contact Us Form</label>
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
<action method="setHeaderTitle" translate="title" module="contacts"><title>Contact Us</title></action>
</reference>
<reference name="content">

<block type="cms/block" name="cms_contact_form_above">
<action method="setBlockId"><block_id>contact_form_above</block_id></action>
</block>

<block type="core/template" name="contactForm" template="contacts/form.phtml"/>

<block type="cms/block" name="cms_contact_form_below">
<action method="setBlockId"><block_id>contact_form_below</block_id></action>
</block>

</reference>
</contacts_index_index>
</layout>

About the Author

Dan Vince

Yet another Web Development Professional

Related Posts

Leave a comment