app/template/tanzo/Block/category_nav_sp.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. {% block javascript %}
  9.     <script>
  10.         $('.bi-chevron-down').on('click', function() {
  11.             var parent = $(this).parent();
  12.             parent.toggleClass("menu_open");
  13.             var child = parent.children('ul');
  14.             if (child.length > 0) {
  15.                 child.slideToggle();
  16.                 return false;
  17.             }
  18.         });
  19.     </script>
  20. {% endblock javascript %}
  21. {% set Categories = repository('Eccube\\Entity\\Category').getList() %}
  22. {% macro tree(Category) %}
  23.     {% from _self import tree %}
  24.     <a href="{{ url('product_list') }}?category_id={{ Category.id }}" class="fs-4 p-3 text-center">
  25.         {{ Category.name }}
  26.     </a>
  27.     {% if Category.children|length > 0 %}
  28.         <ul>
  29.             {% for ChildCategory in Category.children %}
  30.                 <li {{ ChildCategory.children|length > 0 ? 'class="has_children"': ''}}>
  31.                     {{ tree(ChildCategory) }}
  32.                     {{ ChildCategory.children|length > 0 ? '<i class="bi bi-chevron-down"></i>': ''}}
  33.                 </li>
  34.             {% endfor %}
  35.         </ul>
  36.     {% endif %}
  37. {% endmacro %}
  38. {# @see https://github.com/bolt/bolt/pull/2388 #}
  39. {% from _self import tree %}
  40. <div class="ec-headerCategoryArea">
  41.     <!--<div class="ec-headerCategoryArea__heading">
  42.         <p>{{ 'カテゴリ一覧'|trans }}</p>
  43.     </div>-->
  44.     <div class="ec-itemNav">
  45.         <ul class="ec-itemNav__nav d-block font_serif">
  46.             {% for Category in Categories %}
  47.                 <li {{ Category.children|length > 0 ? 'class="has_children"': ''}}>
  48.                     {{ tree(Category) }}
  49.                     {{ Category.children|length > 0 ? '<i class="bi bi-chevron-down"></i>': ''}}
  50.                 </li>
  51.             {% endfor %}
  52.         </ul>
  53.     </div>
  54. </div>