app/template/default/Block/product_sidemenu.twig line 38

Open in your IDE?
  1. {% set break = false %}
  2. {% set cat = "" %}
  3. {% if Product is not null %}
  4. {% if Product.ProductCategories is not empty %}
  5.             {% for ProductCategory in Product.ProductCategories if not break %}
  6.                 {% if ProductCategory.Category.name == "ヴァイスシュヴァルツ" %}
  7.                     {% set cat = ProductCategory.Category.name %}
  8.                     {% set break = true %}
  9.                 {% elseif ProductCategory.Category.name == "ポケモン" %}
  10.                     {% set cat = ProductCategory.Category.name %}
  11.                     {% set break = true %}
  12.                 {% endif %}
  13.             {% endfor %}
  14. {% endif %}
  15. {% endif %}
  16. {% if cat == "ヴァイスシュヴァルツ" %}
  17.     <div class="title-box">
  18.         <a href="{{url('homepage')}}products/list?category_id=8" class="titlebtn"><img src="{{ asset('/html/user_data/assets/img/weis.png') }}" alt=""></a>
  19.         <div class="sbbtn-box">
  20.             <div class="graybtn">
  21.                 <div>
  22.                     <a href="{{url('homepage')}}products/list?category_id=8">買う</a>
  23.                 </div>
  24.             </div>
  25.             <div class="buybtn">
  26.                 <div>
  27.                     <a href="{{url('homepage')}}products/list?category_id=218">売る</a>
  28.                 </div>
  29.             </div>
  30.         </div>
  31.     </div>
  32.     {{ render(path('block_side_serch_buy')) }}
  33.     {% set Categories = repository('Eccube\\Entity\\Category').findBy({'Parent' : 9}) %}
  34.     {# @see https://github.com/bolt/bolt/pull/2388 #}
  35.     {% from _self import tree %}
  36.     <div class="side-cat1">
  37.         <div class="side-cat-smallbox">
  38.             <a href="{{url('homepage')}}products/list?category_id=221">シュヴァルツサイド</a>
  39.             <ul>
  40.             {% for Category in Categories %}
  41.                 <li>{{ tree(Category) }}</li>
  42.             {% endfor %}
  43.             </ul>
  44.         </div>
  45.     </div>
  46.     {% set Categories = repository('Eccube\\Entity\\Category').findBy({'Parent' : 10}) %}
  47.     {# @see https://github.com/bolt/bolt/pull/2388 #}
  48.     {% from _self import tree %}
  49.     <div class="side-cat1">
  50.         <div class="side-cat-smallbox">
  51.             <a href="{{url('homepage')}}products/list?category_id=220">ヴァイスサイド</a>
  52.             <ul>
  53.             {% for Category in Categories %}
  54.                 <li>{{ tree(Category) }}</li>
  55.             {% endfor %}
  56.             </ul>
  57.         </div>
  58.     </div>
  59. {% elseif cat == "ポケモン" %}
  60.     <div class="title-box">
  61.         <a href="{{url('homepage')}}products/list?category_id=7" class="titlebtn"><img src="{{ asset('/html/user_data/assets/img/poke.png') }}" alt=""></a>
  62.         <div class="sbbtn-box">
  63.             <div class="salebtn">
  64.                 <div>
  65.                     <a href="{{url('homepage')}}products/list?category_id=7">買う</a>
  66.                 </div>
  67.             </div>
  68.             <div class="graybtn">
  69.                 <div>
  70.                     <a href="{{url('homepage')}}products/list?category_id=219">売る</a>
  71.                 </div>
  72.             </div>
  73.         </div>
  74.     </div>
  75.     {{ render(path('block_side_serch_buy')) }}
  76.     {% set Categories = repository('Eccube\\Entity\\Category').findBy({'Parent' : 7}) %}
  77.     {# @see https://github.com/bolt/bolt/pull/2388 #}
  78.     {% from _self import tree %}
  79.     <div class="side-cat1">
  80.         <div class="side-cat-smallbox">
  81.             <a href="{{url('homepage')}}products/list?category_id=219">ポケモン</a>
  82.             <ul>
  83.             {% for Category in Categories %}
  84.                 <li>{{ tree(Category) }}</li>
  85.             {% endfor %}
  86.             </ul>
  87.         </div>
  88.     </div>
  89.                     
  90. {% endif %}
  91. {% macro tree(Category) %}
  92.     {% from _self import tree %}
  93.         <a href="{{ url('product_list') }}?category_id={{ Category.id }}">
  94.             {{ Category.name }}
  95.         </a>
  96.         {% if Category.children|length > 0 %}
  97.             <ul>
  98.                 {% for ChildCategory in Category.children %}
  99.                     <li>
  100.                         {{ tree(ChildCategory) }}
  101.                     </li>
  102.                 {% endfor %}
  103.             </ul>
  104.         {% endif %}
  105. {% endmacro %}