app/template/unishop/Block/category_def.twig line 1

Open in your IDE?
  1. {% macro tree(Category) %}
  2.     {% from _self import tree %}
  3.     <a href="{{ url('product_list') }}?category_id={{ Category.id }}"{% if Category.children|length > 0 %}class="toggle"{% endif %} >
  4.         {{ Category.name }}
  5.     </a>
  6.     {% if Category.children|length > 0 %}
  7.         <ul class="child_categories">
  8.             {% for ChildCategory in Category.children %}
  9.                 <li data-category-id="{{ ChildCategory.id }}">
  10.                     {{ tree(ChildCategory) }}
  11.                 </li>
  12.             {% endfor %}
  13.         </ul>
  14.     {% endif %}
  15. {% endmacro %}
  16. <!--indexでの呼び出し:.indexcat-->
  17. {% set Categories = repository('Eccube\\Entity\\Category').getList() %}
  18. {% from _self import tree %}
  19. <ul class="catelist2">
  20.     <li class="allitem">
  21.         <a class="iconimg00" href="{{ url('product_list') }}?mode=&category_id=&name=&pageno=1&disp_number=30">全ての商品</a>
  22.     </li>
  23.     {% for c in Categories %}
  24.         {% if c.School is not null and c.School.school_id == app.user.School.school_id %}
  25.         <li data-category-id="{{ c.id }}" class="top_category">
  26.             {{ tree(c) }}
  27.         </li>
  28.         {% endif %}
  29.     {% endfor %}
  30.     {% if(SetProductCount > 0) %}
  31.     <li{% if product_type is defined and product_type=='set' %} class="activ"{% endif %}><a class="iconimg13" href="{{ url('product_list') }}?product_type=set">セット</a></li>
  32.     {% endif %}
  33. </ul>