Jump to content

Problem showing subcategory images


Recommended Posts

Hi my theme uses tmmegamenu. I want to show the subcategory images but i cant find the solution. I know that i have to modify this function:

 protected function generateCategoriesMenu($categories)
    {
        $html = '';

        foreach ($categories as $category) {
            if ($category['level_depth'] > 1) {
                $cat = new Category($category['id_category']);
                $link = Tools::HtmlEntitiesUTF8($cat->getLink());
                
            } else {
                $link = $this->context->link->getPageLink('index');
            }

            $html .= '<li'.(($this->page_name == 'category'
                && (int)Tools::getValue('id_category') == (int)$category['id_category']) ? ' class="sfHoverForce category"' : ' class="category"').'>';
            $html .= '<img class="foto_categorias" src="';
            $html .= $foto;
            $html .= '">';
            $html .= '<a href="'.$link.'" title="'.$category['name'].'">'.$category['name'].'</a>';

            if (isset($category['children']) && !empty($category['children'])) {
                $html .= '<ul>';
                    $html .= $this->generateCategoriesMenu($category['children'], 1);
                $html .= '</ul>';
            }

            $html .= '</li>';
        }

        return $html;
    }

I created the variable $fotos to create the src of the image, but i cant find the function or class to do it. Can you help me please ??

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...