{#
This file is part of EC-CUBE
Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
http://www.ec-cube.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() %}
{% set start_date = '2021-09-06'|date('Y-m-d') %}
{% set end_date = '2021-09-27'|date('Y-m-d') %}
{% set sale_campaign_id = 174 %}
{% if start_date <= date()|date('Y-m-d') and date()|date('Y-m-d') <= end_date %}
{% set campaign_valid = true %}
{% else %}
{% set campaign_valid = false %}
{% endif %}
{% set Categories = repository('Eccube\\Entity\\Category').getList() %}
{% macro tree(Category, level) %}
{% from _self import tree %}
{% if level == 0 %}
<a href="{{ url('product_list') }}?category_id={{ Category.id }}">
{{ Category.name }}
</a>
{% else %}
<a href="{{ url('product_list') }}?category_id={{ Category.id }}" style="color:#2a83a2!important">
{{ Category.name }}
</a>
{% endif %}
{% if Category.children|length > 0 %}
<ul>
{% for ChildCategory in Category.children %}
<li>
{{ tree(ChildCategory, 1) }}
</li>
{% endfor %}
</ul>
{% endif %}
{% endmacro %}
{# @see https://github.com/bolt/bolt/pull/2388 #}
{% from _self import tree %}
<style>
#campaign_sp {
background-color: red !important;
border: 3px double #fff;
}
#campaign_sp a {
color: white!important;
}
</style>
<div class="ec-headerCategoryArea">
<div class="ec-headerCategoryArea__heading">
<p><a href="{{ url('product_list') }}">{{ '全商品一覧'|trans }}</a></p>
</div>
<div class="ec-itemNav">
<ul class="ec-itemNav__nav">
{% if campaign_valid %}
<li id="campaign_sp">
<a href="{{ url('product_list') }}?category_id={{ sale_campaign_id }}">セール</a>
</li>
{% endif %}
{% for Category in Categories %}
{% if Category.id not in [10,19,sale_campaign_id] %}
<li>
{{ tree(Category, 0) }}
</li>
{% endif %}
{% endfor %}
</ul>
</div>
</div>