{#
This file is part of EC-CUBE
Copyright(c) LOCKON CO.,LTD. All Rights Reserved.
http://www.lockon.co.jp/
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
#}
{% set Categories = repository('Eccube\\Entity\\Category').getList() %}
{% macro tree(Category) %}
{% from _self import tree %}
<a href="{{ url('product_list') }}?category_id={{ Category.id }}">
{{ Category.name }}
</a>
{% if Category.children|length > 0 %}
<ul>
{% for ChildCategory in Category.children %}
<li>
{{ tree(ChildCategory) }}
</li>
{% endfor %}
</ul>
{% endif %}
{% endmacro %}
{# @see https://github.com/bolt/bolt/pull/2388 #}
{% set customer_class = get_customer_class() %}
{% from _self import tree %}
<div class="ec-headerCategoryArea">
<div class="ec-headerCategoryArea__heading">
<p>{{ 'カテゴリ一覧'|trans }}</p>
</div>
<div class="ec-itemNav">
<ul class="ec-itemNav__nav">
{% for Category in Categories %}
{% if Category.id == 22 %}{# 学割カテゴリの表示 #}
{% if customer_class and customer_class.id == 1 %}
<li>
{{ tree(Category) }}
</li>
{% endif %}
{% elseif Category.id == 23 %}{# 社販(55%)カテゴリの表示 #}
{% if customer_class and customer_class.id == 2 %}
<li>
{{ tree(Category) }}
</li>
{% endif %}
{% elseif Category.id == 24 %}{# 特定(20%)カテゴリの表示 #}
{% if customer_class and customer_class.id == 3 %}
<li>
{{ tree(Category) }}
</li>
{% endif %}
{% elseif Category.id == 25 %}{# 社販(70%)カテゴリの表示 #}
{% if customer_class and customer_class.id == 4 %}
<li>
{{ tree(Category) }}
</li>
{% endif %}
{% else %}
<li>
{{ tree(Category) }}
</li>
{% endif %}
{% endfor %}
</ul>
</div>
</div>