Jump to content

Hide a category in the menu with tmcategories module


carolinelecoq

Recommended Posts

Hello,

 

I'm using the module "tm categories" for my horizontal top menu.
It displays all categories but i want to hide some from the menu (and keep category accessible with the URL).

I think it's related to the tmcategories.php file in this line :
    public function getTree($resultParents, $resultIds, $maxDepth, $id_category = 1, $currentDepth = 0)

How to indicate to exclude some categories id ?

Thank you in advance for your help.
 

Link to comment
Share on other sites

I think the solution is in this part of code (tmcategories.php)

public function getTree($resultParents, $resultIds, $maxDepth, $id_category = 1, $currentDepth = 0)
    {
        global $link;
        $children = array();
        if (isset($resultParents[$id_category]) AND sizeof($resultParents[$id_category]) AND ($maxDepth == 0 OR $currentDepth < $maxDepth))
            foreach ($resultParents[$id_category] as $subcat)
                $children[] = $this->getTree($resultParents, $resultIds, $maxDepth, $subcat['id_category'], $currentDepth + 1);
        if (!isset($resultIds[$id_category]))
            return false;
        return array('id' => $id_category, 'link' => $link->getCategoryLink($id_category, $resultIds[$id_category]['link_rewrite']),
                     'name' => $resultIds[$id_category]['name'], 'desc'=> $resultIds[$id_category]['description'],
                     'children' => $children);
    }

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...