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

Open in your IDE?
  1. {% macro tree(Category, school) %}
  2.     {% from _self import tree %}
  3.     <a href="{{ url('product_list') }}?category_id={{ Category.id }}&s={{ school }}"{% 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, school) }}
  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. {% if app.user.school.isBrotherEnabled and app.user.visible_brothers %}
  20.     <ul>
  21.         <li class="allitem">
  22.             <a class="iconimg00" href="{{ url('product_list') }}?mode=&category_id=&name=&pageno=1&disp_number=30">全ての商品</a>
  23.         </li>
  24.         <li class="catelist1">
  25.             <p>{{ app.user.school.school_name }}</p>
  26.             <ul class="catelist2">
  27.                 <li class="allitem">
  28.                     <a class="iconimg00" href="{{ url('product_list') }}?mode=&category_id=&name=&pageno=1&disp_number=30&s={{ app.user.school.school_id }}">全ての商品</a>
  29.                 </li>
  30.                 {% for c in Categories %}
  31.                     {% if c.School is not null and c.School.school_id == app.user.School.school_id %}
  32.                     <li data-category-id="{{ c.id }}" class="top_category">
  33.                         {{ tree(c, app.user.School.school_id) }}
  34.                     </li>
  35.                     {% endif %}
  36.                 {% endfor %}
  37.                 {% if(SetProductCount > 0) %}
  38.                 <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>
  39.                 {% endif %}
  40.             </ul>
  41.         </li>
  42.         {% for brother in app.user.visible_brothers %}
  43.             {% if brother.school and app.user.school.school_id != brother.school.school_id %}
  44.                 <li>
  45.                     <p>{{ brother.school.school_name }}</p>
  46.                     <ul class="catelist2">
  47.                         <li class="allitem">
  48.                             <a class="iconimg00" href="{{ url('product_list') }}?mode=&category_id=&name=&pageno=1&disp_number=30&s={{ brother.school.school_id }}">全ての商品</a>
  49.                         </li>
  50.                         {% for c in Categories %}
  51.                             {% if c.School is not null and c.School.school_id == brother.School.school_id %}
  52.                             <li data-category-id="{{ c.id }}" class="top_category">
  53.                                 {{ tree(c, brother.School.school_id ) }}
  54.                             </li>
  55.                             {% endif %}
  56.                         {% endfor %}
  57.                     </ul>
  58.                 </li>
  59.             {% endif %}
  60.         {% endfor %}
  61.     </ul>
  62. {% else %}
  63.     <ul class="catelist2">
  64.         <li class="allitem">
  65.             <a class="iconimg00" href="{{ url('product_list') }}?mode=&category_id=&name=&pageno=1&disp_number=30">全ての商品</a>
  66.         </li>
  67.         {% for c in Categories %}
  68.             {% if c.School is not null and c.School.school_id == app.user.School.school_id %}
  69.             <li data-category-id="{{ c.id }}" class="top_category">
  70.                 {{ tree(c, app.user.School.school_id) }}
  71.             </li>
  72.             {% endif %}
  73.         {% endfor %}
  74.         {% if(SetProductCount > 0) %}
  75.         <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>
  76.         {% endif %}
  77.     </ul>
  78. {% endif %}