Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

change column-layout of contact form in Magento

Tags:

magento

where can I change the column-layout (2-column left, 2-column right etc) of the default contact page in Magento?

thanks

like image 668
pixeltocode Avatar asked Jul 23 '10 00:07

pixeltocode


People also ask

How do I change the contact us page layout in Magento?

Customize the Contact Us Page in Magento 2Navigate to Content > Blocks and find the Contact Us Info block. 2. Add the changes you need to the content of the page and Save the block. After you apply the changes, the Contact Us page will be different based on your configurations.

What is the correct way to inject CMS block in a layout?

A CMS block is injected into the layout by using the Magento/Cms/Block/Block class with the block_id argument. Any block or container can be used as a reference. As a result, the CMS block added to the bottom of the page.


3 Answers

First, determine the "layout handle" for the contact page. If this is the page you're talking about, then your layout handle is

contacts_index_index

Next, find the layout handle in your layout.xml file

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

Change the setTemplate call to reference your template

<reference name="root">
    <action method="setTemplate"><template>page/1column.phtml</template></action>
    <action method="setHeaderTitle" translate="title" module="contacts"><title>Contact Us</title></action>
</reference>

Alternately, add the handle reference to your local.xml file. The local.xml file is applied last, so whatever goes in there "wins"

<layout>
    <contacts_index_index>
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-left.phtml</template></action>    
        </reference>
    </contacts_index_index>
</layout>   
like image 71
Alan Storm Avatar answered Sep 28 '22 09:09

Alan Storm


The layout of the contact page is set in contacts.xml. So, an alternative method is:

1. Find contacts.xml in the base layout folder
2. Copy the content in that file
3. Create a new contacts.xml file in the layout folder of your template
4. Paste the content of that file and find the line that sets the default layout

<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>

5. Change that line to whatever you want your default layout to be

<reference name="root">
   <action method="setTemplate"><template>page/1column.phtml</template></action>
   <action method="setHeaderTitle" translate="title" module="contacts"><title>Contact Us</title></action>
</reference>

6. Save, and it overrides the default layout

like image 43
Big Tree Energy Avatar answered Sep 28 '22 09:09

Big Tree Energy


Firstly, Find contacts.xml in the base layout folder, then in 41 line,

change this code from

<action method="setTemplate"><template>page/2columns-right.phtml</template></action>

to

<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
like image 29
user2753425 Avatar answered Sep 28 '22 11:09

user2753425