Within our magento site we have the root category for the shop (this is just “default category”). Under this we have set-up some top-level categories (let’s for example call these “electronics” and “furniture”), with a bunch of sub categories.
So as an example our category structure might be
- Electronics
- DVD players
- MP3 Players
- Computers
- Furniture
- 3 Piece’s
- Armchairs
- Tables
- Sofabeds
I have managed to edit the layout/template for the “sub categories” such as “dvd players” so that we display a custom product list view.
Now what we want to do, is for the top level categories (the very first categories under the root category), is display a custom grid of all the subcategories and their associated thumbnail images, not the product list!
How do i assign a completely different template just for those top level categories?
If someone could provide an insight on how to do this and the step’s we need to take (i should be ok with the code itself, its just how to implement it such as custom modules and templates)
Thanks
Sounds like you want a custom page layout that you can apply to your top level categories. A page layout is essentially a named page template that you can select in a dropdown to apply to products or categories.
To define a layout, add it in the
global/page/layoutsnode of a module’sconfig.xml, like so:Then you just need to create the
page/my-custom-layout.phtmltemplate file somewhere in the app/design template fallback chain.The
layout_handlenode specifies the name of a new layout handle that will be added to any page that uses this layout, allowing you to target it in layout XML files with a<my_custom_layout>node.The
.phtmlfile you’re referencing will be the template for the entire HTML page, so it should include<html>,<head>,<body>tags and anything else you’d find in one of the defaultpage/*.phtmltemplates (1column, empty, 2columns-left, etc). Between this and targeted layout XML, you can completely customize this page from scratch.The final step is just to select this new layout under the “Custom Design” tab when editing each of your parent categories in Catalog->Manage Categories. If you don’t see your layout in the dropdown, make sure your XML is configured properly (see
app/code/core/Mage/Page/etc/config.xmlfor reference) and refresh your cache.