Magento 1.9 – How to Move Page Title Above Breadcrumbs for Category Pages

categorylayoutmagento-1.9

I don't want to do this on every page, but on a site I am working on, there is a design requirement to show the Page Title above the breadcrumbs only on Category/Sub-category pages, irrespective if it is a 1-column, 2-column, etc layout.

I can play around with the template files, and use conditions, but I feel this is messy and would therefore like to know if there is a more elegant way of achieving this using local.xml?

I was thinking of something along the lines of:

<catalog_category_default>
    <reference name="root">
        <action method="unsetChild"><name>page_content_heading</name></action>
    </reference>
<catalog_category_default>

Am I correct or at least half-way there?

Best Answer

To rephrase your question: You want to add the title above the breadcrumb only but on all category pages.

If you want to solve this via layout.xml (which is the best way), you have to remove the Headline from the template/catalog/category/view.phtmlsince it is nested there. After you add a template named headline.phtml in the same folder. You then add this block where you want to have it. The example below adds it to both types of category display:

      <catalog_category_layered translate="label">
                ...
            <reference name="root">
                <block type="catalog/category_view" name="category.headline" as="category-headline" template="catalog/category/headline.phtml"/>
            </reference>
                ...
       </catalog_category_layered>
      <catalog_category_default >
                ...
            <reference name="root">
                <block type="catalog/category_view" name="category.headline" as="category-headline" template="catalog/category/headline.phtml"/>
            </reference>
                ...
       </catalog_category_default>

Now you add the your new block to i.E. to 1column.html as ` getChildHtml('category-headline') ?>

I haven't tested it but otherwise search for "Add phtml block to Magento"