0
votes

Before posting this, i have looked in to the following, but all of them did not helped me and i was not able to add the block.

magento - adding and positioning a block using local.xml

Magento - Add phtml file to layout block

Magento 1.7:Show category image on category page in full width in a 2 column template

I want to add the category image on top of the page. Currently it is displayed under the product list view, and i want it to be above the left navigation, so that it takes full page width.

I created a template file in mytheme/template/catalog/category/image.phtml and i just added some text "I am here".

After that i add the following xml to my local.xml file under catalog_category_default

<reference name="content">
    <block type="catalog/category_view" name="category.image" template="catalog/category/image.phtml"></block>
</reference>

But it is still not working and the text is not displayed there. When this text is displayed, then i will display the category image, but for now i just want to make the block working and display it on top of the page.

Thank you

1

1 Answers

2
votes

Maybe your category does not load the layout handle catalog_category_default. There are 2 handles for categories _default and _layered.
To make sure you cover both cases and so you won't duplicate markup try this approach.
define your custom handle.

<my_awsome_category_handle>
    <reference name="content">
        <block type="catalog/category_view" name="category.image" template="catalog/category/image.phtml"></block>
    </reference>
</my_awsome_category_handle>

Then include that handle in both category handles.

<catalog_category_default>
    <update handle="my_awsome_category_handle" />
</catalog_category_default>
<catalog_category_layered>
    <update handle="my_awsome_category_handle" />
</catalog_category_layered>