Get a Free Quote

You will receive quote within 24 Hrs

We respect your privacy
Magento Web Developer

How to List Sub Categories Products on Category Page in Magento?

By: Rushik Shah

Magento is ecommerce software and is available to download freely from their website. It is highly robust software, which is one of the reasons that it has risen to popularity so fast. Magneto by itself has many features built into it and thus reduces the need for you to add any extensions. However there are many extensions available for you to install into Magento to enhance the user experience. Furthermore if you wish for a truly unique website or custom functionality it is likely you will need the assistance of a Magento Web developer.

The steps below describe how to list sub-categories on a category page:-

1. For this you need to go to the admin section of the Magento installation.

2. From the admin menu you need to select CMS Static Blocks

3. Hit the ‘Add New Block’ button on the top right.

Create a new block by the name ‘Subcategory Listing’ with the following content:

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

Now save the block and go back to the admin menu.
Select Catalog > Manage Categories from the admin menu
Select the category that has sub-categories and under the ‘Display Settings Tab’ reflect the following:

Display mode: Static Block only
Only CMS Block: Sub Category Listing
Is Anchor: No

Save this by hitting ‘Save Category’ on the top right.
We now need to create a new file by the name ‘subcategory_listing.phtml’ with the following content.



Now connect to your web server directory using FTP and browser to where your Magento files are stored.
Go to the directory app/design/frontend/default//template/catalog/navigation/ and upload this file created above. You can create the directories missing from the path above if required.

While on the FTP connection is still alive you need to go to the directory app/code/core/Mage/Catalog/Block/Navigation.php and download the file navigation.php.

Now still on the FTP, navigate to the directory app/code/local/Mage/Catalog/Block and upload the copied navigation.php file to this directory.

Now open the file navigation.php in your favourite editor and look for the following code:

public function getCurrentChildCategories()

$layer = Mage::getSingleton(‘catalog/layer’);
$category = $layer->getCurrentCategory();
/* @var $category Mage_Catalog_Model_Category */
$categories = $category->getChildrenCategories();
$product Collection = Mage::getResourceModel(‘catalog/product_collection’);
$layer->prepared Product Collection($product Collection);
$product Collection->add Count To Categories($categories);
return $categories;

Replace this code with the following:

public function getCurrentChildCategories()
$layer = Mage::getSingleton(‘catalog/layer’);
$category = $layer->getCurrentCategory();
/* @var $category Mage_Catalog_Model_Category */
$collection = Mage::getModel(‘catalog/category’)->getCollection();
/* @var $collection Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection */
->addAttributeToFilter(‘is_active’, 1)
->addEd Filter($category->getChildren())
->setOrder(‘position’, ‘ASC’)
->join UrlRewrite()

$product Collection = Mage::getResourceModel(‘catalog/product_collection’);
$layer->prepared Product Collection($product Collection);
$product Collection->add Count To Categories($collection);
return $collection;

Now re-upload this file to the web server.

That is it you are done; if you browse to the frontend of the site and open the category with the sub-categories added to it should show the subcategories listed.

If in case they are not present you may need to clear the Magento cache first and then attempt load the page.

Feel free to contact our Magento web development team today.

Why Choose Alakmalak As a Your Growth Partner?

Looking to outsource Website Design & Development Work?

Alakmalak is a web development company in India that offers services for several technologies. There have been around for a very long time and have developed over 2500 projects for clients all around the world. They have highly skilled web developers with a great deal of experience.

  • how to list sub categories poducts on category page in magento?

OVER 600 Small, Medium and Large Enterprise business clients have chosen us from 35 COUNTRIES

  • Federico Bilches

    I want to thank all Alakmalak team for take my project and help me to improve my website! Thank you for your responsibility and seriousness at the time to do corrections and improvements on my website and for always be in touch with me. Highly recommended! Great team! Great company! I'm very thankful Alakmalak!

  • Frank M. Cali
    Frank M. Cali.USA

    A few kinds words to say about Alakmalak programming and design. Working with these guys is always such a great relief. You know you are getting your stuff done right and usually always in a timely fashion. I’m a middle man for the most part And my clients are always happy with the end result.

Share via
Copy link
Powered by Social Snap