0

I have just installed the Magento Bootstrap theme webcomm/magento-boilerplate

By default, Mangeto loads the 2column-right.phtml as the skeleton layout template. How do I ask it to load another template, say 2column-left.phtml, as the default template? I tried to added following XML to local.xml in the theme package but no avail:

    <default>
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
        </reference>
    </default>

So how to do it? I know that I can specifically target a product or category page to be rendered in certain skeleton template but what I want is to apply this layout by default, especially for home page, either by editing the XML files or doing it in the backend admin panel?

  • did you remove cache ? – Rajeev K Tomy Aug 13 '14 at 3:29
  • Yes, already flushed – Frank Dai Aug 13 '14 at 3:33
  • try cms_index_index instead for default handler in local.xml – Rajeev K Tomy Aug 13 '14 at 3:34
2

Default page template for product description page:

Add this to your <layout> in local.xml:

<catalog_category_default translate="label">
     <reference name="root">
         <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
     </reference>
   </catalog_category_default>

For CMS pages this can be done from the backend.

From

Cms > Pages > Home > Design > Layout

Add the tag to the root of the page in the layout xml

<catalog_product_view>
    <reference name="root">
        <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
    </reference>
</catalog_product_view>

For more info this LINK can be a help.

  • question is set page template for all pages or for homepage atleast. This sets page template for product view page and category page – Rajeev K Tomy Aug 13 '14 at 5:00
  • Yes I have hence added in my answer for cms pages you can update layout from admin itself, have you tried that? Also updated my answer on how this can be done from admin – TBI Infotech Aug 13 '14 at 5:02
1

It seems that the highest priority of layout update is from setting in the admin panel. I simply go to CMS/Page to find the home url and update it to corresponding layout.

0

In your layout.xml, I can see a small mistake that every developers does. I am not sure whether you did it. You didnt use <layout /> wrapper in your layout file

ie

<layout>
    <default>
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
        </reference>
    </default>
</layout>

else you can try this code snippet for home page

<layout>
    <cms_index_index>
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
        </reference>
    </cms_index_index>
</layout>

Always clear your cache before make a try. Hope that helps

  • The XML snippet as just part of local.xml and it is wrapped in <layout> tag. I also tried cms_index_index but still not working. I think my XML code is fine but is it possible that there are other handler with higher priority over my handler in local.xml? The theme package only contains one XML file in the layout fold and it is the local.xml – Frank Dai Aug 13 '14 at 3:44
  • are you sure your current theme is set to boilerplate/default through admin ? – Rajeev K Tomy Aug 13 '14 at 3:54
  • yes. The theme already takes effect – Frank Dai Aug 13 '14 at 4:40
0

You definitely need to add an update handle inside your tags

<update handle="page_two_columns_left" />

like in this example:

<catalog_product_view translate="label">
        <label>Catalog Product View (Any)</label>
        <update handle="page_two_columns_left" />
        <!-- Mage_Catalog -->
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
        </reference>
        ...
 </catalog_product_view>
0

You don't have to programmatically set it.

Follow my approach here:

Open CMS -> Page from admin panel -> Select Home page (suppose you want to check template for home page) -> design tab -> select the layout you want.

I'm pretty sure you already know the answer as your question was posted 3 yrs back.

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.