Custom Magento CMS page layout

Custom Magento CMS page layout

Last week I had a request to add new custom layout for few cms pages in one Magento shop. It’s really useful for different static pages of your shop. First create extension with only config file in it: app/code/local/Inchoo/AdditionalCmsPageLayouts/etc/config.xml

<?xml version="1.0"?>
<config>
 <global>
  <page>
   <layouts>
    <custom_static_page_one>
     <label>Custom static page 1</label>
     <template>page/custom-static-page-1.phtml</template>
    </custom_static_page_one>
   </layouts>
  </page>
 </global>
</config>

Then activate it: app/etc/modules/Inchoo_AdditionalCmsPageLayouts.xml

<?xml version="1.0"?>
<config>
 <modules>
  <Inchoo_AdditionalCmsPageLayouts>
   <codePool>local</codePool>
   <active>true</active>
  </Inchoo_AdditionalCmsPageLayouts>
 </modules>
</config>

Clear cache, add your page/custom-static-page-1.phtml template file (or copy some default one for start) to your current theme and you’re done πŸ˜‰ There is also tutorial about this on Magento Wiki. And yes, default Magento page layouts can be overridden the same way. Default layouts config can be found in app/code/core/Mage/Page/etc/config.xml along with used xml code structure, so check it out. Thank you for listening!

You made it all the way down here so you must have enjoyed this post! You may also like:

How to keep your CMS blocks organized (and not go insane) Adrian Bece
Adrian Bece, | 10

How to keep your CMS blocks organized (and not go insane)

Injecting Variables into a Magento CMS static block Thomas Spigel
Thomas Spigel, | 9

Injecting Variables into a Magento CMS static block

Magento CMS syntax – part2 Ivan Weiler
Ivan Weiler, | 16

Magento CMS syntax – part2

59 comments

  1. Hi, Does any one know how to integrate AMP in Magento without extentions? With this I will be able to load my page quickly. Thanks for your time.

  2. Hello Ivan, Thanks for posting such a wonderful tutorial. I followed the and can it works perfectly. I have a question specific to my problem. I created one layout β€œxyz” which works fine, but theme’s local.xml has

    <catalog_category_default>
    <reference name="root">
    <action method="setTemplate"><template>page/1column.phtml</template></action>
    </reference>
    <reference name="content">
    <block type="my_block_name" before=""></block>
    </reference>
    </catalog_category_default>

    This creates problem for me, no matter what layout I choose, it prepends the block into content block.

    can I exclude this block for my newly created layout? If yes, how and where exactly?

    Its ok if this block is default but for few layouts I dont wont this block be prepended.

    Thanks in Advance.

    Please delete all my previous comments, as those were attempt of posting code, but it was getting truncated. πŸ™

  3. Hi Ivan, thanks for a great quick tip. I would just add that in your config.xml you can also add

    <layout_handle>page_custom_static_page_one</layout_handle>

    and then you can bind layout updates in your modules and custom pages. Eg. this if you want to change header template for this specific layout:

    <page_custom_static_page_one>
            <reference name="header">
                <action method="setTemplate">
                    <template>page/html/header-type1.phtml</template>
                </action>
            </reference>
    </page_custom_static_page_one>

    Cheers, Jan

  4. Hi, i used the same steps and created custom home page layout in my local server. But after moving it into live server, i cant see that page layout at back-end. My magento version is 1.9.2.4. Can you help. Thanks in advance.

    1. I have the same issue – works fine on local machine but when pushed live it doesn’t work. Any advice?

    1. That’s pretty much the same… Don’t shamelessly advertise your blog like that.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <blockquote cite=""> <code> <del datetime=""> <em> <s> <strike> <strong>. You may use following syntax for source code: <pre><code>$current = "Inchoo";</code></pre>.

Tell us about your project

Drop us a line. We'd love to know more about your project.