79616847

Date: 2025-05-11 19:40:53
Score: 0.5
Natty:
Report link

на сайте tematut нашел следующее решение

public_html/modules/blocktopmenu/blocktopmenu.php

ищем функцию generateCategoriesMenu и комментируем её для сохранности оригинала

далее вставляем следующее

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

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

        /* Whenever a category is not active we shouldnt display it to customer */
        if ((bool)$category['active'] === false) {
            continue;
        }

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

        //$html .= '<img src="/img/c/'.(int)$category['id_category'].'-medium_default.jpg'.'" class="imgm" height="30" /><br>';
        if($category['level_depth'] == '3' AND Tools::file_exists_cache(_PS_CAT_IMG_DIR_.(int)$category['id_category'].'-medium_default.jpg'))
            $html .= '<img src="/img/c/'.(int)$category['id_category'].'-medium_default.jpg'.'" class="imgm" height="125" /><br>';
        $html .= $category['name'];

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


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

    return $html;
}
Reasons:
  • Long answer (-1):
  • Has code block (-0.5):
  • No latin characters (1):
  • Low reputation (1):
Posted by: Artem S