blog

How To Display Sub Categories on a Category Page in Magento 1 (with images)

blog

Author:Rowan Burgess

  • 13 Feb 2021
  • 20 minutes
Magento v1.x.x.x

It’s a pretty common requirement to show a list of sub categories inside a parent category page, instead of products. Who knows why this wasn’t a standard function of Magento, but thankfully there’s a simple workaround.

So let’s begin at the top.

1. In Magento admin navigate to CMS>Static Blocks

2. Click “Add New Block” at the top right

3. Create the new static block with the following details:

Block Title: Sub Category Listing

Identifier: subcategory_listing

Status: Enabled

Content:

{{block type="catalog/navigation" template="catalog/navigation/subcategory_listing.phtml"}}

4. Click Save Block in the top right

5. Navigate to the parent category under Catalog>Manage Categories and within the Display Settings Tab set to the following:

Display mode: Static Block only

CMS Block: Sub Category Listing

Is Anchor: No

6. Click Save Category in the top right


7. Create a new file called subcategory_listing.phtml in:

app/design/frontend/yourpackagename/yourthemename/template/catalog/navigation/

Containing the following code:

getCurrentCategory();
                      $_categories = $_category->getCollection()->addAttributeToSelect(array('url_key','name','image','all_children','is_anchor','description'))
                      ->addAttributeToFilter('is_active', 1)
                      ->addIdFilter($_category->getChildren())
                      ->setOrder('position', 'ASC')
                      ->joinUrlRewrite();
                      ?>

                                   
bg-banner-white
  • Let’s talk about how I can help you