Contacts Page - Adding a Static Block to the contact page in Magento

This is a specific example to help you understand easily, after finding the method, you can apply it on many different sites.

Magento-contact-us-page Step 1: Create Static Block to insert the contacts page “Identifier”: block_contact_top

  • Sign in Magento backend.
  • CMS => Static Block => Add New Block (Create a new block)
  • Select the scope of application for the Block in Store View (for default if you want to apply to all)
  • Name in the Title Block, Identifier is "block_contact_top"
  • The contents: Content is HTML, example: <p> This is Static Block appeared on top contacts </ p>
  • Then, Save Block

Step 2: Claim that block on the Contact module in app / design / frontend / fortis / default / layout => contacts.xml file.

Search handle <contact_index_index> </ contact_index_index> to declare code inside, just before </ contact_index_index> as follows:

<contact_index_index>

....

<reference name = "contactForm">

         <block type = "cms / block" name = "block_contact_top" is before = "-">

                <action method = "setBlockId"> <block_id> block_contact_top </ block_id> </ action>

        </ block>

</ reference> </ contact_index_index>

Reference to parent block named ContactForm, in this block, we declare a new block, that is Static Block type = "cms / block" is named reference name = "block_contact_top", and the content of Static Block is already the one created in step 1. (just put the block id and block name overlap for remember easily).

Step 3: To Bock block_contact_top appears in Frontend, we must call it in the template file of contacts module in app / design / frontend / fortis / default / template / contacts => file form.phtml

<Div id = "messages_product_view"> <? Php echo $ this-> getMessagesBlock () -> getGroupedHtml ()?> </ Div>

<div class = "page-title">

    <h1> <? Php echo Mage :: helper ('contacts') -> __ ('Contact Us')?> </h1>

</div>

 <? Php echo $ this-> getChildHtml ('block_contact_top')?>

<Form action = "<? Php echo $ this-> getFormAction ();?>" Id = "contactForm" method = "post">

    <div class = "fieldset">

        <h2 class = "legend"> <? Php echo Mage :: helper ('contacts') -> __ ('Contact Information')?> </h2>

        <Ul class = "form-list">

Call Block with a red line above code in place to Block appears on the site Contact!

Refresh the page Contacts outside Frontend, you will see results.

I wish you success!

Expansion: You can add another Static Block beneath Contact Form in the Contact page, called this Static Block is block_contact_map. Inside, our google map is in the form of cards <Iframe> </ iframe>. You can refer to the article: How to embed Google Maps into the Magento Static Block