How to display Magento subcategories on the category page

18 August 2015| Post by Graham

AuthorGraham

Display subcategories instead of products on a product listing (category) page seems like an obvious option to have in Magento, but for some reason it is not possible.. Unless you know how.
[newslettercta]

Step 1. Create The Template File

({{app-dir}}/app/design/frontend/{{theme-folder}}/default/category/view/subcategories.phtml)

				

getCurrentChildCategories() ?>

count()): ?>

There are no Sub categories belonging to this category.

I’ve stolen this HTML from a personal project, but you can obviously change it to however you like.

Step 2. Create Magento CMS Block

Create a static block in the Magento admin with the key “subcategories”.

To do this, go to CMS > Static Blocks > Add New Block.

Populate it with the following content :

				
{{block type=”catalog/navigation” name=”catalog.subcategories” template=”catalog/category/view/subcategories.phtml”}}

This creates a new Mage_Catalog_Block_Navigation instance, it is automatically populated with the current category layer by default. Then finally you are telling the block which template to use to render this information.

Step 3. Configure Your Parent Category

Navigate to the parent category in the Magento admin interface, then click on the “Display Settings” tab located at the top of the section.

Ensure that “Static Block only” is selected, “Is Anchor” is set to no and also the “CMS Block” select dropdown is selected as the new “Subcategories” block you created in Step 2.

magento-display-settings-for-subcategories

Clear your cache and you should now see subcategories instead of products as desired on the listing page.

Scroll