3

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?

2

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"

  • Hey Bernhard. Thanks for the reply. No, I need to be able to do this across all Level 1, 2 and 3 categories ... except CMS pages – maGz Jul 28 '15 at 17:44
  • I edited the reply – Bernhard Prange Jul 28 '15 at 20:57

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.