Adding a block to magento category page using local.xml -


Before posting it, I have looked at the following, but not all of them helped me and I Was not able to add block

I want to add an image of the category at the top of the page. This product list view , And I want to put it above the left navigation, so that it can take full page width.

I have created a template file in mytheme / template / catalog / category / image.phtml and I have just added some text "I am here" < P> After that, I will call my local.xml file to catalog_category_default

  & lt; Reference Name = "Content" & gt; & Lt; Block type = "catalog / category_view" name = "category.image" template = "catalog / category / image.file" & gt; & Lt; / Block & gt; & Lt; / References & gt;   

But it still does not work and the text is not displayed there. When this text is displayed, I will display the image of the category, but for now I just want to work on the block and want to display it at the top of the page.

Thank you

Your category layout may not load handling catalog_category_default . There are 2 handles for categories _default and _layered .
To ensure that you cover both cases and therefore you will not duplicate this approach to markup.
Define your custom handle

  & lt; My_awsome_category_handle & gt; & Lt; Reference Name = "Content" & gt; & Lt; Block type = "catalog / category_view" name = "category.image" template = "catalog / category / image.file" & gt; & Lt; / Block & gt; & Lt; / References & gt; & Lt; / My_awsome_category_handle & gt;   

Then include the handles in both the class handle.

  & lt; Catalog_category_default & gt; & Lt; Update handle = "my_awsome_category_handle" /> & Lt; / Catalog_category_default & gt; & Lt; Catalog_category_layered & gt; & Lt; Update handle = "my_awsome_category_handle" /> & Lt; / Catalog_category_layered & gt;    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -