This tutorial is going to show you how to get all categories and sub categories in magento.In This script I have shown all subcategories on the basis of main category means Root Catalog’s Id.
If you change the $id = 1 then it will display suabcategory upto the first level that looks like below.

first level categories
first level categories

 

If you change the $id = 3 then it will display suabcategory upto the second level that looks like below.

all second level categories
all second level categories

So lets starts the coding part :

Or You can get the categories tree by another method means by collecting all ids from catalog model.

How to get all categories and sub categories in Magento
Tagged on:                 

Leave a Reply

Your email address will not be published.