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. {# 非表示にするカテゴリ ID:
  10.    21=DIY材料 / 28=石材 / 44=照明 (非表示要件)
  11.    34=ベランダ・バルコニー (親 cat=19 と同名で階層 2 段になるため子は非表示) #}
  12. {% set HIDDEN_CATEGORY_IDS = [21, 28, 44, 34] %}
  13. {% macro tree(Category, HIDDEN_CATEGORY_IDS) %}
  14.     {% from _self import tree %}
  15.     {% if Category.id not in HIDDEN_CATEGORY_IDS %}
  16.     <a href="{{ url('product_list') }}?category_id={{ Category.id }}">
  17.         {{ Category.name }}
  18.     </a>
  19.     {% if Category.children|length > 0 %}
  20.         <ul>
  21.             {% for ChildCategory in Category.children %}
  22.                 {% if ChildCategory.id not in HIDDEN_CATEGORY_IDS %}
  23.                 <li>
  24.                     {{ tree(ChildCategory, HIDDEN_CATEGORY_IDS) }}
  25.                 </li>
  26.                 {% endif %}
  27.             {% endfor %}
  28.         </ul>
  29.     {% endif %}
  30.     {% endif %}
  31. {% endmacro %}
  32. {# @see https://github.com/bolt/bolt/pull/2388 #}
  33. {% from _self import tree %}
  34. <div class="ec-headerCategoryArea">
  35.     <div class="ec-headerCategoryArea__heading">
  36.         <p>{{ 'カテゴリから探す'|trans }}</p>
  37.     </div>
  38.     <div class="ec-itemNav">
  39.         <ul class="ec-itemNav__nav">
  40.             {% for Category in Categories %}
  41.                 {% if Category.id == 26 %}
  42.                     {# 'その他' (cat=26) is a grouping-only parent. The PC header
  43.                        (commit 7300adb7) replaced the single 'その他' entry with its
  44.                        child categories as direct items so customers don't have to
  45.                        drill in. Mirror that on SP: surface cat=26's non-hidden
  46.                        children at the top level instead of nesting them under
  47.                        'その他'. getList() orders each level by sort_no DESC, so the
  48.                        resulting order (パーゴラ / 立水栓 / 手すり / ストックヤード /
  49.                        ゴミステーション / 面格子 / 窓シャッター / 玄関ドア) matches
  50.                        the PC header. #}
  51.                     {% for ChildCategory in Category.children %}
  52.                         {% if ChildCategory.id not in HIDDEN_CATEGORY_IDS %}
  53.                         <li>
  54.                             {{ tree(ChildCategory, HIDDEN_CATEGORY_IDS) }}
  55.                         </li>
  56.                         {% endif %}
  57.                     {% endfor %}
  58.                 {% elseif Category.id not in HIDDEN_CATEGORY_IDS %}
  59.                 <li>
  60.                     {{ tree(Category, HIDDEN_CATEGORY_IDS) }}
  61.                 </li>
  62.                 {% endif %}
  63.             {% endfor %}
  64.         </ul>
  65.     </div>
  66. </div>
  67. <div class="ec-headerCategoryArea">
  68.     <div class="ec-headerCategoryArea__heading">
  69.         <p>{{ 'ブランドから探す'|trans }}</p>
  70.     </div>
  71.     <div class="ec-itemNav">
  72.         <ul class="ec-itemNav__nav">
  73.             <li><a href="#">LIXIL</a></li>
  74.             <li><a href="#">YKK AP</a></li>
  75.             <li><a href="#">三協アルミ</a></li>
  76.             <li><a href="#">四国化成</a></li>
  77.             <li><a href="#">タカショー</a></li>
  78.             <li><a href="#">パナソニック</a></li>
  79.             <li><a href="#">イナバ</a></li>
  80.             <li><a href="#">ヨドコウ</a></li>
  81.             <li><a href="#">ユニソン</a></li>
  82.             <li><a href="#">エスビック</a></li>
  83.         </ul>
  84.     </div>
  85. </div>