How to make a multi-level menu of categories in the sidebar with a drop-down list of subcategories from the standard opencart template?

<div class="list-group"> <div class="box-heading filter_element_title ui-widget-header ui-corner-all">Каталог товаров</div> {% for category in categories %} {% if category.category_id == category_id %} <a href="{{ category.href }}" class="list-group-item active">{{ category.name }}</a> {% if category.children %} {% for child in category.children %} {% if child.category_id == child_id %} <a href="{{ child.href }}" class="list-group-item active">&nbsp;&nbsp;&nbsp;- {{ child.name }}</a> {% else %} <a href="{{ child.href }}" class="list-group-item">&nbsp;&nbsp;&nbsp;- {{ child.name }}</a> {% endif %} {% endfor %} {% endif %} {% else %} <a href="{{ category.href }}" class="list-group-item">{{ category.name }}</a> {% endif %} {% endfor %} </div> 

  • See how the menu is implemented in controller / common / menu.php and view / theme / {your_theme} /common/menu.twig; analyze, reproduce the code; Supplement the question with the work done if it does not work, or ply if it is all gut;) - Kirill Korushkin

0