I have a script to display all categories

$obj = new Mage_Catalog_Block_Navigation();
$store_cats = $obj->getStoreCategories();
$current_cat    = $obj->getCurrentCategory();
$current_cat    = (is_object($current_cat) ? $current_cat->getName() : '');

foreach ($store_cats as $cat) {
    if ($cat->getName() == $current_cat) {
        echo '<li class="current"><a href="'.$this->getCategoryUrl($cat).'">'.$cat->getName()."</a>\n<ul>\n";
        foreach ($obj->getCurrentChildCategories() as $subcat) {
            echo '<li><a href="'.$this->getCategoryUrl($subcat).'">'.$subcat->getName()."</a></li>\n";
        echo "</ul>\n</li>\n";
    } else {
        echo '<li><a href="'.$this->getCategoryUrl($cat).'">'.$cat->getName()."</a></li>\n";

But some of the categories are linked to a static block so i want to filter it out, anyone know how to do that?

1 Answer 1


I guess you know how to join tables and get data form there. Rest i am telling you here.

If you do inspect element then you can see the name of that attribute for CMS Block is landing page. Now go to eav_attribute table and find that attribute there. In my case the id is 50 (Most probably for you too.). Now go to catalog_category_entity_int table and check which entity_id(category id) has value for attribute_id = 50. Rest category ids value will be NULL.

check the image here.

Hope you get the whole idea. Enjoy !!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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