1

So this is it. I want to set the 2columns-left to any page of Magento. Not even 1 1column.
I want to do this because I've just installed a plugin which adds the category navigation on the left column and I want to see the categories from any place. I've tried editing local.xml like this:

<?xml version="1.0"?> 
<layout version="0.1.0">
    <catalog_product_view>
        <reference name="root">
            <action method="setTemplate">
                <template>page/2columns-left.phtml</template>
            </action>
        </reference>
    </catalog_product_view>
</layout>

But with no total success. I can see the left column but it's not placed on the left of the col-main but inside, at the end of the information of product view.

EDIT:

<div class="main">
    <?php echo $this->getChildHtml('breadcrumbs') ?>
    <div class="col-main">
        <?php echo $this->getChildHtml('global_messages') ?>
        <?php echo $this->getChildHtml('content') ?>
    </div>
    <div class="col-left sidebar">
        <?php echo $this->getChildHtml('left') ?>
        <?php echo $this->getChildHtml('custom_left_block1') ?>
        <?php echo $this->getChildHtml('custom_left_block2') ?>
        <?php echo $this->getChildHtml('custom_left_block_clean1') ?>
        <?php echo $this->getChildHtml('custom_left_block_clean2') ?>
        <?php echo $this->getChildHtml('custom_left_block3') ?>
        <?php echo $this->getChildHtml('custom_left_block4') ?>
    </div>
</div>

2columns-left seems correct. In fact, it shows up correctly to any page. It's only on the catalog product view where it looks diferent. So it's not either something related to css, if I'm not wrong.

EDIT 2:

<?xml version="1.0"?> 
<layout version="0.1.0">
    <default>
        <remove name="sale.reorder.sidebar"/>
    </default>


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

    <!--All Cms Pages-->
    <cms_page>
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
        </reference>
    </cms_page>

    <!--Category View-->
    <catalog_category_view>
        <!--Set Page Template-->
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
        </reference>
    </catalog_category_view>

    <!--Category View With Layered Navigation-->
    <catalog_category_layered>
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
        </reference>
    </catalog_category_layered>

    <!--Onepage Checkout Index Page-->
    <checkout_onepage_index>
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
        </reference>
    </checkout_onepage_index>

    <!--Onepage Checkout Success Page-->
    <checkout_onepage_success>
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
        </reference>
    </checkout_onepage_success>

    <!--Customer Accound Pages-->
    <customer_account>
        <!--Adds Body Class For All Dashboard Pages - MUST when Dashboard is present-->
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
        </reference>
    </customer_account>

    <!--Customer Logged In-->
    <customer_logged_in>
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
        </reference>
    </customer_logged_in>

    <!--Customer Logged Out-->
    <customer_logged_out>
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
        </reference>
    </customer_logged_out>

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

    <!--Catalogsearch Result Page-->
    <catalogsearch_result_index>
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
        </reference>
    </catalogsearch_result_index>

    <!--Advanced Search Result Page-->
    <catalogsearch_advanced_result>
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
        </reference>
    </catalogsearch_advanced_result>

    <!--Advanced Search Page-->
    <catalogsearch_advanced_index>
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
        </reference>
    </catalogsearch_advanced_index>

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

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

This is my entire local.xml. I can see the left column at the left side but it seems that <?php echo $this->getChildHtml('left') ?> doesn't load the navigation menu on all pages, only some. And I still see the left-column inside of the main-column on catalog_product_view.

SOLUTION:

If the left or right column isn't placed where it should but only in some specific pages it's because there are some not closed divs on that specific phtml. It was view.phtml in my case.

I've also found out the solution for the fact that in some pages the <?php echo $this->getChildHtml('left') ?> didn't show up. It's because, for example, in customer.xml there was a <remove name="left"/> and any change i made on my local.xml to <default> didn't apply. It was overwritten my local.xml.

3
  • When you can see the left column, but it is not displayed correctly, I would assume that your CSS needs to be edited. Oct 7, 2015 at 16:05
  • Check 2columns-left.phtml file. May be design issue like div misplacement
    – vinothavn
    Oct 7, 2015 at 16:19
  • I've just edited my question.
    – aleixrav
    Oct 8, 2015 at 7:41

1 Answer 1

3

Lets debug, in view.phtml please add below code for getting template

$this->getLayout()->getBlock('root')->getTemplateFile();

If it given value ...page/2columns-left.phtml then the template file properly applied at your theme.Then at any where force full set template for product details page. and you need to check all layout files,.

Also it give proper result then you can to set 2columns-left.phtml to all pages by using handler as default <default></default>.

<default> <!-- this handler is called  on all pages -->
    <reference name="root">
        <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
    </reference>
</default>
5
  • I've tried adding your code to add to local.xml but it doesn't apply to any page.
    – aleixrav
    Oct 8, 2015 at 7:42
  • have you check $this->getLayout()->getBlock('root')->getTemplateFile(); given 2-columns-left... in catalog/product/view.phtml
    – Amit Bera
    Oct 8, 2015 at 8:11
  • I've tried and it seems it doesn't apply. Anyway, as that didn't work, I've just added any kind of page which can be shown, if I haven't missed any. I'll edit the question.
    – aleixrav
    Oct 8, 2015 at 8:37
  • 1
    It's solved, it was something related to my list.phtml, a non-closed div which made the col-left appear inside of col-main. But I don't still understand why in some pages like in the login page it doesn't show up the navigator, but the left column does.
    – aleixrav
    Oct 9, 2015 at 10:12
  • I've finally found out the solution for this too, it's on the question, after SOLUTION.
    – aleixrav
    Oct 9, 2015 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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