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 9144295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:14:04+00:00 2026-06-17T10:14:04+00:00

How I can get all categories and subcategories if the category is active, but

  • 0

How I can get all categories and subcategories if the category is active, but “Include in Navigation Menu” is set to “No”?

I try to use this:

<?php 
$_categories = Mage::getBlockSingleton('catalog/navigation'); 
foreach ($_categories->getStoreCategories() as $_category) { 
$category = Mage::getModel('catalog/category'); 
$category->load($_category->getId()); 
$subcategories = explode(',', $category->getChildren()); 
?> 
<dl> 
<dt><?php echo $this->htmlEscape($_category->getName()); ?></dt> 
<dd> 
<ol> 
<?php 
foreach ($subcategories as $subcategoryId) { 
$category->load($subcategoryId); 
echo '<li><a href="' . $category->getURL() . '">' . $category->getName() . '</a></li>'; 
} 
?> 
</ol> 
</dd> 
</dl> 
<?php

} 
?> 

But if a category’s “Include in Nav menu” is “No”, it won’t show on the front page!

  • 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-17T10:14:05+00:00Added an answer on June 17, 2026 at 10:14 am

    You only need to change one thing! When you call $_categories = Mage::getBlockSingleton('catalog/navigation') you’re actually grabbing the categories from the catalog/navigation model specifically – the filtering out of “non navigation” categories is already complete. Instead, we can grab a collection from the catalog/category model to make sure we get all categories available on the site:

    $categories = Mage::getModel('catalog/category')
            ->getCollection()
            ->addAttributeToSelect('*')
            ->addIsActiveFilter();
    

    Note that I am using addIsActiveFilter() to make sure we only get categories that are currently active / enabled.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First I can get all sub categories by js,but I only get the category
How can I get all this to not only output on the screen, but
Is there any API by which one can get all the categories of a
I'm trying to get all the categories about the specific blogpost but it will
Human readable URLs with nested categories like /category/subcategory/n-subcategories/article. I'm using CakePHP 2.2.3 and can't
When i try to submit the form below i get this error WARNING: Can't
I am using this code snippet to get all category items from mySql db
Can get all triples with value null in specific field? All people with date_of_birth
In My wordpress blog I can get all the archive list in monthly view.
I am wondering how I can get all the files with File Info and

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.