I have below code it will fetch the category as well as subcategory from Magento.

The Problem is that I have around more then 300 category and subcategory. So I can not change the manually in Magento Category Management.

I need to a sort category based on Name.

For Example I have attach the Image

Category listing


1 Answer 1


Hello I have found the Solutions for this.

Using ksort() we can sort the category and we can display the category in sorting order.

foreach ($this->getStoreCategories() as $_category)
   $_categories[$_category->getName()] = $_category;
........normaly use our Code.

Now you can see the all Main category will be Coming in sorting order form A-Z.

Not the answer you're looking for? Browse other questions tagged or ask your own question.