My name is Clayton McIlrath and I am an entrepreneur currently living in CO. I personally enjoy the process of learning, exploring, and doing all things creative as well as sharing my experiences with others. Being an entrepreneur and business owner, I hope that my experiences may help someone else start their own venture and find success and freedom as I have! Feel free to contact me anytime for questions or opportunities.

close
more

»

«


Magento: Add New CMS Page Layout

Want to take your Magento Themes to the next level? Have multiple layouts? If you’re looking to add a new page layout in Magento, create a custom layout or create a new theme layout then this solution is probably for you.

Add a new CMS Page Layout

First we have to create a module. Create file: app/etc/modules/Mage_Page.xml

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

Then copy this whole folder: app/code/core/Mage/Page to app/code/local/Mage

What we’ve done is taken a core module and copied it into our local module. This lets us override any core functionality without have to worry about it breaking in future update (or undoing if you mess up).

Now we need to edit: app/code/core/Mage/Page/etc/config.xml and look around line 46 and you can define your own layout, I’m going to call mine “home”

<layouts>
	<home module="page" translate="label">
        <label>Home</label>
        <template>page/home.phtml</template>
        <layout_handle>page_home</layout_handle>
    </home>
    <empty module="page" translate="label">
        <label>Empty</label>
        <template>page/one-column.phtml</template>
        <layout_handle>page_empty</layout_handle>
    </empty>
    <one_column module="page" translate="label">
        <label>1 column</label>
        <template>page/1column.phtml</template>
        <layout_handle>page_one_column</layout_handle>
    </one_column>
    <two_columns_left module="page" translate="label">
        <label>2 columns with left bar</label>
        <template>page/2columns-left.phtml</template>
        <layout_handle>page_two_columns_left</layout_handle>
    </two_columns_left>
    <two_columns_right module="page" translate="label">
        <label>2 columns with right bar</label>
        <template>page/2columns-right.phtml</template>
        <layout_handle>page_two_columns_right</layout_handle>
    </two_columns_right>
    <three_columns module="page" translate="label">
        <label>3 columns</label>
        <template>page/3columns.phtml</template>
        <layout_handle>page_three_columns</layout_handle>
    </three_columns>
</layouts>

Now all you have to do is make a template for this page. Navigate to your theme directory: app/design/frontend/YOUR_THEME/YOUR_THEME/template/page/ and create a new template called home.phtml. I suggest using another existing template as a starting point, such as 3columns.phtml so that you know what variables to work around. This will enable a custom layout option for CMS pages once you’re finished. I’ve tested this with 1.3 series but nothing previous or after that. If you have any comments or questions feel free to post them here or read the forum on Magento’s site for more details.

  • http://diendankienthuc.net Viet Su

    To day I try searching with bing, and I find your site and this useful post. Thank you. I need it.

  • http://diendankienthuc.net Viet Su

    To day I try searching with bing, and I find your site and this useful post. Thank you. I need it.

  • jgonz

    HELP!

    Thank you for this tutorial but I have hit a snag. I did everything exactly as you stated above. I got the new layout to show up in the drop-down menu in the Admin / CMS section. I created the new page from the Admin / CMS with my new layout but when I go to preview the page it just redirects me back to the home page… wtf?!?!?

    Please… any assistance with this is greatly appreciated!!

    Thanks!!!

    j.

  • jgonz

    HELP!

    Thank you for this tutorial but I have hit a snag. I did everything exactly as you stated above. I got the new layout to show up in the drop-down menu in the Admin / CMS section. I created the new page from the Admin / CMS with my new layout but when I go to preview the page it just redirects me back to the home page… wtf?!?!?

    Please… any assistance with this is greatly appreciated!!

    Thanks!!!

    j.

  • http://www.rainbowskill.com Rainbow Skill

    The way you describe about new CMS Page Layout i like that. Thank u so much.

  • http://www.rainbowskill.com Rainbow Skill

    The way you describe about new CMS Page Layout i like that. Thank u so much.

  • http://danpolant.com dpolant

    Great tutorial, I would have been fumbling for a while without this. I think there should be one correction – when you say

    “Now we need to edit: app/code/core/Mage/Page/etc/config.xml … ”

    I believe you actually have to edit /app/code/local/Mage/Page/etc/config.xml because by copying this module here you are telling magento to ignore the original config.xml. I could be wrong, but that is what I had to do in order to make this work.

    Your tutorial saved me tons of time, I will be returning here for more Magento tips in the future!

  • http://danpolant.com dpolant

    Great tutorial, I would have been fumbling for a while without this. I think there should be one correction – when you say

    “Now we need to edit: app/code/core/Mage/Page/etc/config.xml … ”

    I believe you actually have to edit /app/code/local/Mage/Page/etc/config.xml because by copying this module here you are telling magento to ignore the original config.xml. I could be wrong, but that is what I had to do in order to make this work.

    Your tutorial saved me tons of time, I will be returning here for more Magento tips in the future!

  • John

    This was a MASSIVELY helpful tut. Clear, concise, easy to understand – great work!!

  • John

    This was a MASSIVELY helpful tut. Clear, concise, easy to understand – great work!!

  • http://www.kingrosales.com King Rosales

    @Clayton thanks for this tutorial! Its great to see tutorials like yours that weren’t posted in 2008! =)

  • http://www.kingrosales.com King Rosales

    @Clayton thanks for this tutorial! Its great to see tutorials like yours that weren’t posted in 2008! =)

  • http://thinkclay.com Clay McIlrath

    You’re very welcome. Feel free to hit me up if you have any future requests for tutorials.

  • http://thinkclay.com Clay McIlrath

    You’re very welcome. Feel free to hit me up if you have any future requests for tutorials.

  • http://rickpickett.com Reechard

    Great work, Clay. Been using this on two sites and choosing new/custom templates is a breeze! It works in 1.4.0.1 FYI.

  • http://rickpickett.com Reechard

    Great work, Clay. Been using this on two sites and choosing new/custom templates is a breeze! It works in 1.4.0.1 FYI.

  • Magedev

    Hi Clay…thanks a lot for the tutorial..worked wonderfully on 1.4.0.1..but I did an upgrade to 1.4.1.0 and its not working anymore. The options don’t show up anymore in the admin end. Please let us know if any modifications need to be made for 1.4..

  • Magedev

    Hi Clay…thanks a lot for the tutorial..worked wonderfully on 1.4.0.1..but I did an upgrade to 1.4.1.0 and its not working anymore. The options don’t show up anymore in the admin end. Please let us know if any modifications need to be made for 1.4..

  • http://www.shanestrong.com Shane

    @Clay – Not the greatest at Magento but couldn’t you put this inside your frontend->layout->page.xml. This would also solve the issue that Magedev is having because if it goes in the local then it would just get overridden everytime you upgrade.

  • http://www.shanestrong.com Shane

    @Clay – Not the greatest at Magento but couldn’t you put this inside your frontend->layout->page.xml. This would also solve the issue that Magedev is having because if it goes in the local then it would just get overridden everytime you upgrade.

  • Anonymous

    it is a great advantage fot multiple layouts

  • http://hotdiggity.myopenid.com/ hotdiggity

    Using Magento 1.4, I copied config.xml from: app/code/core/Mage/Page/etc to: app/code/local/Mage/etc and inserted the necessary code, avoiding copying the whole ‘Page’ directory. There was also no apparent need to create the page module above.

  • http://www.gvlab.info/ Guido

    More than this Tutorial to run on Magento 1.4.0.1 I also change the config in app / code / local / Mage / Page / etc
    Tnx very much, great work
    Guido

  • Raj

    very helpful

  • Internetoutfitters

    Unbelievable how much misinformation is out there about this. Thanks for the straightforward solution. Works in PE 1.8.0

  • imacg

    This worked great, I just edited the config.xml in local and the new template was available, but I have a problem when applying to a category and its products pages – it does not seem to apply the changes to the category products as selected in the apply to dropdown – but it does work on the category – any ideas.?

  • http://twitter.com/OpenJuice Bruno Munro-Lafon

    Great Tutorial and saved loads of time. We are Using Magento 1.4.1.1, we just added just the config file to app/code/local/Mage/Page/etc as it should fall back to the core for the other files we also found that app/etc/modules/Mage_Page.xml was needed in order to work correctly.

  • Kannankrp425

    Thank you very much, Great Job…

    -Kannankrp-

  • Anonymous

    Nice solution. Thanks for taking the time to share!

  • http://twitter.com/Saidurh Saidur Hossain

    Thanks! You should mention that you need to refresh the cache for the changes to take place.

  • Nelly

    Just done this mod on v1.5.0.1 works a treat, many thanks.

  • Ellement

    Thanks, very helpful!

  • Nishant Sood

    Awesome Article….Worked Perfectly in Magento ver. 1.4.0.1. Please do not forget to clear the cache.

  • Bikash

    this new test comment

  • Gfdh

    gfgf

  • http://www.geekieblog.com Helder Martins

    You might want to check my solution here: http://j.mp/k9nf3N, it actually explains it detailed, assuming you are a newbie, step by step.

  • http://www.apptha.com/category/extension/Magento/OneStepCheckout Magento One Page Checkout

    Hi.. perfect  step by step guide for beginners

  • Tc

    mujse to nahi ho raha h

  • Kanishka

    Perfect solution………… Perfect step by step……………….. thanks a lot……………….really very helpful

  • Ahmad Nawaz

    I have tried your method and then after clearing cache when I created and a new cms page and click on the design, I did not see any custom page layout. All were the same old one. What can be the problem?

  • Laura

    Thanks for your easy-to-follow blog post – much easier to understand than the stuff on the Magento site!

  • vipin tomar

    thnx

  • VIPIN TOMAR

    really helpful…it works gud

  • VIPIN TOMAR

    hey cant i change layout through css…orr any other way to do the same ….i m looking for a short trick

  • VIPIN TOMAR

    well i hv a blog link for such a thing….it works its short n its amazing
    http://www.e-commercewebdesign.co.uk/blog/magento-tutorials/create-new-layouts-for-your-template-pages.php

close