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. {# {% macro tree(Category) %}
  10.     {% from _self import tree %}
  11.    {% for test in cat_category.Children.snapshot %}
  12.     <a href="{{ url('product_list') }}?category_id={{ test.id }}">
  13.         {{ test.name }}
  14.     </a>
  15.     {% if test.children|length > 0 %}
  16.         <ul>
  17.             {% for ChildCategory in test.children %}
  18.                 <li>
  19.                     {{ tree(ChildCategory) }}
  20.                 </li>
  21.             {% endfor %}
  22.         </ul>
  23.     {% endif %}
  24.             {% endfor %}
  25.         {% endmacro %} #}
  26.         {# @see https://github.com/bolt/bolt/pull/2388 #}
  27. {# {% from _self import tree %}
  28. {% for Category in Categories %}
  29. {{ tree(Category) }}
  30. {% endfor %}
  31. #}
  32. {% set cat_category = repository("Eccube\\Entity\\Category").find(cat_id_category) %}
  33.     <div class="ec-headerCategoryArea">
  34.         <div class="ec-headerCategoryArea__heading">
  35.             <p>{{ 'カテゴリ一覧'|trans }}</p>
  36.         </div>
  37.         <div class="ec-itemNav">
  38.             <ul class="ec-itemNav__nav">
  39.                 <li>
  40.                     {% for c in cat_category.Children.snapshot %}
  41.                       <div 
  42.                       v-on:click="side_cat_toggle({{ c.id }})"
  43.                       class="parent_block">
  44.                         <a href="" >
  45.                       <span>
  46.                             {{ c.name }}
  47.                     </span>
  48.                         </a>
  49.                 </div>
  50.                 <transition name="fade">
  51.                     <div class="child_block"  v-show="show_contents.indexOf({{ c.id }}) >= 0">
  52.                         {% for ChildCategory in c.children %}
  53.                                 <a href="{{ url('product_list') }}?category_id={{ ChildCategory.id }}">
  54.                                     <span>
  55.                                     {{ ChildCategory.name }}
  56.                                         
  57.                                     </span>
  58.                                 </a>
  59.                         {% endfor %}
  60.                     </div>
  61.                 </transition>
  62.             {% endfor %}
  63.         </li>
  64.     </ul>
  65. </div>
  66. </div>