Magento Layout – Call Left Column Block Within Main Column

categorylayouttemplate

I have a category list page which uses the 1column.phtml template. However, when the user navigates to a category where there are no subcategories – and only its products are displayed – I would like to call the left column.
The problem is that it is that I am still using the 1column template for this situation.

How can I call the left column?

Best Answer

If I remember correctly, the CategoryController adds a layout handle for categories with no subcategories [link], meaning that this can be done via layout XML, e.g. in local.xml layout file:

<?xml version="1.0" encoding="UTF-8"?>
<layout>
    <catalog_category_layered_nochildren>
        <action method="setTemplate" block="root">
            <tpl>page/2columns-left.phtml</tpl>
        </action>
    </catalog_category_layered_nochildren>
</layout>