Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the page layout in Magento?

Tags:

magento

I want to change my category page layout to 2columns-left.phtml. The default is a 3 column layout. I only want to set the category page layout to 2columns-left.phtml. The rest should keep the default page layout (3 columns). How can I do this?

like image 672
user1188320 Avatar asked Mar 18 '12 23:03

user1188320


People also ask

What is page layout in Magento 2?

A page layout file defines the page wireframe, for example, one-column layout. Technically page layout is an . xml file defining the structure inside the <body> section of the HTML page markup. Page layouts feature only containers.

How can I get layout in Magento 2?

You can get a list of called Layout XML for specific pages by Magento\Framework\App\View class. Call getLayout() method from Magento\Framework\App\View. php class. getLayout()->getUpdate()->getHandles() used for getting all the handles of a page.


2 Answers

You can do this for categories individually under the Design tab. You can do this for all categories by adding a local.xml to your custom theme's layout folder which contains the following:

<?xml version="1.0"?>
<layout>

    <my_category_root_template>
        <reference name="root">
            <tpl>page/2columns-left.phtml</tpl>
        </reference>
    <my_category_root_template>

    <catalog_category_layered>
        <update handle="my_category_root_template" />
    </catalog_category_layered>

    <catalog_category_layered_nochildren>
        <update handle="my_category_root_template" />
    </catalog_category_layered_nochildren>

    <catalog_category_default>
        <update handle="my_category_root_template" />
    </catalog_category_default>

    <!-- EDIT: forgot about search results page -->
    <catalogsearch_advanced_result>
        <update handle="my_category_root_template" />
    </catalogsearch_advanced_result>

<layout>

For further info, Magebase has a great Layout XML primer, and Alan Storm wrote the book on it.

like image 155
benmarks Avatar answered Sep 22 '22 14:09

benmarks


I don't have much experience with magneto but i think it may work.

Go to admin->Catalog->Categories->Manage Categories

Then go to ->Custom Design

You will find Page Layout option there change that to whatever you like.

like image 40
Ricky Sharma Avatar answered Sep 22 '22 14:09

Ricky Sharma