app/template/default/Block/category_nav_pc.twig line 1

Open in your IDE?
  1. {#
  2. This file is part of EC-CUBE
  3. Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  4. http://www.ec-cube.co.jp/
  5. For the full copyright and license information, please view the LICENSE
  6. file that was distributed with this source code.
  7. #}
  8. {% set Categories = repository('Eccube\\Entity\\Category').getList() %}
  9. {% macro tree(Category) %}
  10.     {% from _self import tree %}
  11.     <a href="{{ url('product_list') }}?category_id={{ Category.id }}">
  12.         {{ Category.name }}
  13.     </a>
  14.     {% if Category.children|length > 0 %}
  15.         <button type="button" class="cate_child_btn">▼</button>
  16.         <ul>
  17.             {% for ChildCategory in Category.children %}
  18.                 <li>
  19.                     {{ tree(ChildCategory) }}
  20.                 </li>
  21.             {% endfor %}
  22.         </ul>
  23.     {% endif %}
  24. {% endmacro %}
  25. {# @see https://github.com/bolt/bolt/pull/2388 #}
  26. {% from _self import tree %}
  27. <div class="ec-categoryNaviRole">
  28.     <div class="ec-headerCategoryArea__heading">
  29.         <p>{{ 'カテゴリ'|trans }}</p>
  30.     </div>
  31.     <div class="ec-itemNav">
  32.         <ul class="ec-itemNav__nav">
  33.             {% for Category in Categories %}
  34.                 <li>
  35.                     {{ tree(Category) }}
  36.                 </li>
  37.             {% endfor %}
  38.         </ul>
  39.     </div>
  40. </div>