1

I'm building a Magento theme that uses only a left column template and a single column template. How do I remove the layout options for a right column template or a three column template in the CMS?

I see that the default page.xml includes this code:

<page_two_columns_right translate="label">
    <label>All Two-Column Layout Pages (Right Column)</label>
    <reference name="root">
        <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
        <!-- Mark root page block that template is applied -->
        <action method="setIsHandle"><applied>1</applied></action>
        <action method="setLayoutCode"><name>two_columns_right</name></action>
    </reference>
</page_two_columns_right>

<page_three_columns translate="label">
    <label>All Three-Column Layout Pages</label>
    <reference name="root">
        <action method="setTemplate"><template>page/3columns.phtml</template></action>
        <!-- Mark root page block that template is applied -->
        <action method="setIsHandle"><applied>1</applied></action>
        <action method="setLayoutCode"><name>three_columns</name></action>
    </reference>
</page_three_columns>

How do I override these options or remove them?

1

I'm not sure, it feels like I'm understanding your question in another way than Rajeev.

Sure you can delete this. As you can see in \Mage_Page_Model_Config I can't find any to delete the pageLayouts later, so we have to avoid that they are added, this can only be done by editing the config.xml file of the Mage_Page module.

Ben explains why and a better(?) alternative!

  • Ben's answer was exactly what I needed! Where's the best place to find documentation for those config.xml files? It seems like knowing the <remove_layouts> directive would be handy to know. – Edwin Smith May 29 '15 at 17:30
  • There is no, as ben writes "you could create a module that can handle remove_layout directives" – Fabian Blechschmidt May 30 '15 at 12:15
1

You don't want to/should not remove those codes from page.xml. Eventhough you are not using other page layouts, removing their definition from page.xml is utter nonsense !!

What you need to do is, you should use the required page layout in your CMS Pages. You can do this in many ways. The most elegant way is putting a layout update via local.xml

File : app\design\frontend\[your-package]\[your-theme]\layout\local.xml

<layout>
    <cms_page_view>
        <reference  name="root">
            <action method="setTemplate">
                <template>3columns.phtml</template> <!-- or you should use `2columns-right.phtml` according to your need -->
            </action>
        </reference>
    </cms_page_view>
</layout>

Or you can simply open the CMS Page from admin side and under design section, you need to put this code. Please note, in this case, the layout of the selected CMS Page only changes.

<reference  name="root">
    <action method="setTemplate">
        <template>3columns.phtml</template> <!-- or you should use `2columns-right.phtml` according to your need -->
    </action>
</reference>
  • Are you saying that there is no way to remove those template options from the CMS? The user will always be able to select a 3 column template, even if one doesn't exist in the current theme? – Edwin Smith May 27 '15 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.