Magento – Custom Category Listing Block

Grab a copy of the code in this video: www.devinrolsen.com Here I wanted to show you how to build a custom magento category listing block that you can use on your own magento store. We will go over each step at getting a category listing of your magneto categories and even a sub category listing.

8 Comments

  • Umm maybe I’m not getting this at all, but aren’t you loading the same category twice?

    You first load the model for the category and then for the sub categories you load it again but add the getChildren() call. If I’m reading your code correctly you could have called getChildren() directly on $category instead of loading again for $subCats.

  • smurkas, you are correct, if you would like to change line 12 to : $subCats = $category->getChildren(); that is perfectly fine.

  • great video, really helped me understand how this works.

    can you help me make the list items link to the categories?

  • @crapshaw figured this out. Just changed the list item structure to include:
    echo $category->getURL();
    and
    echo $subCategory->getUrl();

    thanks again 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *