Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9207247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:20:48+00:00 2026-06-18T00:20:48+00:00

I have successfully created a custom drop-down-menu for each specific category I needed but

  • 0

I have successfully created a custom drop-down-menu for each specific category I needed but one of them needs to load the subcategory within a subcategory and I can’t get it to work.

The working code without the “subcategory within a subcategory” is the following but I need to find out how to add the 3rd level on this code.

 <!-- Vending -->
 <?php $main = Mage::getModel('catalog/category')->load(355) ?>
 <li class="eight"><a href="<?php echo $main->getUrl() ?>"><?php echo $main->getName(); ?></a>
 <?php $children = Mage::getModel('catalog/category')->getCategories(355); ?>
 <ul class="nav_static">
 <?php foreach ($children as $category): ?>
 <li>
 <a href="<?php echo $category->getRequestPath(); ?>">
 <?php echo $category->getName(); ?>
 </a>
 </li>
 <?php endforeach; ?>
 </ul>
 </li>
 <!-- END - Vending -->
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T00:20:49+00:00Added an answer on June 18, 2026 at 12:20 am

    Well, as I have suggested in https://stackoverflow.com/a/14586422/653867 you have to load a category object for your second level categories:

    $cat = Mage::getModel('catalog/category')->load($category->getEntityId());
    

    then you can access its children by executing

    $children = $cat->getChildrenCategories();
    

    The $children variable is a collection of type Mage_Catalog_Model_Resource_Category_Collection, and you can iterate through it to output the next level categories

    I think, your code can be improved a bit if you called getChildrenCategories() on your $main in the first place. You wouldn’t have to load every child in a loop, which can be performance punishing. Instead use this (and it can actually be improved even further with recursive calls, but such setup would include creating extra blocks, which might be too much hassle for this particular case):

     <?php $main = Mage::getModel('catalog/category')->load(355) ?>
     <li class="eight"><a href="<?php echo $main->getUrl() ?>"><?php echo $main->getName(); ?></a>
     <?php $children = $main->getChildrenCategories(); ?>
     <ul class="nav_static">
     <?php foreach ($children as $category): ?>
     <li>
     <a href="<?php echo $category->getUrl(); ?>">
     <?php echo $category->getName();
    
     $subCategories = $category->getChildrenCategories();
     foreach ($subCategories as $subCat) {
     /**
      *your code to output the next level categories
      */
     }
     ?>
     </a>
     </li>
     <?php endforeach; ?>
     </ul>
     </li>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have successfully created one custom dialog box. Dialog box is working good. I
I have successfully created a custom Facebook open graph action, and have been able
i have successfully created distribution profiles and installed on my xcode organiser, but this
Having followed this tutorial, I have successfully created a repeatable type custom field. However,
I have created a custom user model which I am successfully using within my
I have successfully created a working custom STS using the project templates for the
I have created a custom SharePoint web service that was deployed to, and successfully
I have successfully created a custom taxonomy in WordPress, and I created a page
I have successfully created a custom AccessDecisionVoter class and tied it into my web
I have created a custom view helper and i'm calling it successfully. Only problem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.