Magento Adding Category banners to selective category pages

default

Magento has a pretty good way of adding content to category pages, like banners at the top of the page. What if you wanted more control over where it was being placed?
Well, that would require modifying the catalog> Category > view.phtml file.
That’s what we are going to do in this example.

Basically, we will use a conditional statement to show different banners based on which image we want to show.
The first step is to identify the category id’s for each category that needs a unique banner. The rest will get a default banner.

Second step is to create cms static blocks for each unique category id, for example, block-for-cat186. Then add your banner in that static block.
Continue on until you have all the static blocks created for each unique category.
Also create a static block for categories that don’t need a unique banner, but do need a default banner( block-for-othercat).

Once that work is completed, add the following [download id=”2098″] block to your catalog>category>view.phtml template, in your theme’s folder.
For example, app> design> frontend> default> your-theme> template > category > catalog > view.phtml.

Upload your modified view.phtml file into the appropriate folder.
Now when you view categories on the front end, you should be seeing the different banners, based on the category id’s.

This same concept of adding a static block based on category id can be used to place unique content at the bottom of selected categories, which is a common seo request.
How cool is that?

This entry was posted in Magento. Bookmark the permalink.