Adding custom layouts for CMS and Category use with custom module trouble

In order to make it appear in the layout dropdown you need to create a custom module (you can also add something in a core file but please don't do that). Let's name the extension Easylife_Layout. For this you need to create the following files: app/etc/modules/Easylife_Layout.xml - the declaration file

<?xml version="1.0"?>
<config>
    <modules>
        <Easylife_Layout>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Mage_Page />
            </depends>
        </Easylife_Layout>
    </modules>
</config>

app/code/local/Easylife/Layout/etc/config.xml - the configuration file

<?xml version="1.0"?> 
<config>
    <modules>
        <Easylife_Layout>
            <version>0.0.1</version>
        </Easylife_Layout>
    </modules>
    <global>
        <page>
            <layouts> 
                <lookbook module="page" translate="label">
                    <label>Lookbook</label>
                    <template>page/1column-lookbook.phtml</template>
                    <layout_handle>lookbook</layout_handle>
                </lookbook> 
            </layouts>
        </page>
    </global>
    <frontend>
        <layout>
            <updates>
                <easylife_layout>
                    <file>easylife_layout.xml</file>
                </easylife_layout>
            </updates>
        </layout>
    </frontend>
</config>

app/design/frontend/{interface}/{theme}/layout/easylife_layout.xml - the layout file

<?xml version="1.0"?> 
<layout>
    <lookbook translate="label">
        <label>Lookbook</label>
        <reference name="root">
            <action method="setTemplate"><template>page/1column-lookbook.phtml</template></action>
            <action method="setIsHandle"><applied>1</applied></action>
        </reference>
    </lookbook> 
</layout>

The last one is necessary in case you want to be able to reference your custom layout in layout files. Something like:

<update hande="lookbook" />

Clear the cache and...that's it. Le tme know if it works for you.


There are two possibilities:

  1. You add a custom layout to your category and do this:

    <layout>
        <reference name="root">
            <action method="setTemplate"><template>page/1column-lookbook.phtml</template></action>
        </reference>
    </layout>
    
  2. You implement it as a page layout and add it to the config.xml in global/page/layouts/ but I don't know, how to do it exactly.

If you only need it once, you can stay with the first solution. But be careful. There are <action method="setIsHandle"><applied>1</applied></action> in the page.xml Sometimes this setting prevents the change of the template.

To do the first solution: Select your category, got to Custom Design and put everything inside the <layout /> node into the Custom Layout Update textarea, e.g.:

<reference name="root">
    <action method="setBackgroundGraphic">
        <background>two-pieces</background>
    </action>
    <action method="setTemplate">
    <template>page/2columns-right-highStep.phtml</template>
    </action>
    <action method="setIsHandle">
        <applied>1</applied>
    </action>
</reference>