app/template/default/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. {% set Categories = repository('Eccube\\Entity\\Category').getList() %}
  9. {% set CategoriesCount = repository('Eccube\\Entity\\Product').findProductsWithCategoriesCount() %}
  10. {% set Makers = repository('Plugin\\Maker42\\Entity\\Maker').findBy({}, {sort_no: 'desc' }, 5) %}
  11. {% macro tree(Category, CategoriesCount) %}
  12.     {% from _self import tree %}
  13.     <a class="fs-6 js-category-link-sp" href="{{ url('product_list') }}?category_id={{ Category.id }}">
  14.         {% if (Category.Parent == "") %}
  15.             <img class="menu-icon me-2" src="/html/user_data/assets/img/category/{{ Category.id }}.png" alt="{{ Category.name }}">
  16.         {% endif %}
  17.         {{ Category.name }}{% if CategoriesCount[Category.id] is defined %} ({{CategoriesCount[Category.id]|number_format}}){% else %} (0){% endif %}
  18.     </a>
  19.     {% if Category.children|length > 0 %}
  20.         <ul>
  21.             {% for ChildCategory in Category.children %}
  22.                 <li>
  23.                     {{ tree(ChildCategory, CategoriesCount) }}
  24.                 </li>
  25.             {% endfor %}
  26.         </ul>
  27.     {% endif %}
  28. {% endmacro %}
  29. {# @see https://github.com/bolt/bolt/pull/2388 #}
  30. {% from _self import tree %}
  31. <div class="ec-headerCategoryArea">
  32.     <div class="ec-headerCategoryArea__heading">
  33.         <p>{{ 'カテゴリ一覧'|trans }}</p>
  34.     </div>
  35.     <div class="ec-itemNav">
  36.         <ul class="ec-itemNav__nav">
  37.             {% for Category in Categories %}
  38.                 <li>
  39.                     {{ tree(Category, CategoriesCount) }}
  40.                 </li>
  41.             {% endfor %}
  42.         </ul>
  43.     </div>
  44.     <div class="ec-headerCategoryArea__heading">
  45.         <p>{{ 'メーカー一覧'|trans }}</p>
  46.     </div>
  47.     <div class="ec-itemNav maker_list">
  48.         <ul class="ec-itemNav__nav">
  49.             {% for Maker in Makers %}
  50.                 <li><a class='fs-6' href="{{ url('product_list') }}?maker_id={{ Maker.id }}">{{ Maker.name }}</a></li>
  51.             {% endfor %}
  52.         </ul>
  53.         <div class='py-2 px-2'>
  54.             <a href="{{ url('maker') }}"><button class='metroFamilyOrder-button01' type='button'>一覧を見る</button></a>
  55.         </div>
  56.     </div>
  57. </div>