{#
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.
#}
{% macro tree(Category) %}
{% from _self import tree %}
<a href="{{ url('product_list') }}?category_id={{ Category.id }}">
<span>{{ Category.name }}</span>
{% if Category.children|length > 0 %}
<img src="{{ asset('assets/img/common/ic_plus.svg') }}" alt="お気に入り" width="12" height="12" loading="lazy">
{% else %}
<img src="{{ asset('assets/img/common/ic_chervon_right.svg') }}" alt="お気に入り" width="6" height="9" loading="lazy">
{% endif %}
</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 #}
{% from _self import tree %}
<script>
$(document).ready(function() {
$(".ec-drawerRole .ec-headerCategoryArea .ec-itemNav__nav li ul li a, .ec-drawerRole .ec-headerCategoryArea .ec-itemNav__nav li a").on("click", function(e) {
$(this).toggleClass("active");
if($(this).hasClass("active")) {
$(this).find(".ic_plus").addClass("d-none");
$(this).find(".ic_minus").removeClass("d-none");
$(this).closest("li").find("ul").removeClass("d-none");
} else {
$(this).find(".ic_plus").removeClass("d-none");
$(this).find(".ic_minus").addClass("d-none");
$(this).closest("li").find("ul").addClass("d-none");
}
})
})
</script>
<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 TopCategories %}
<li>
{% if Category.id == constant('Customize\\Common\\Constant::DEFAULT_CATEGORY_ID') or Category.id == constant('Customize\\Common\\Constant::MANUFACTURER_CATEGORY_ID') %}
<a href="javascript:void(0)">
<span>{{ Category.name }}</span>
<img class="ic_plus" src="{{ asset('assets/img/common/ic_plus.svg') }}" alt="お気に入り" width="12" height="12" loading="lazy">
<img class="ic_minus d-none" src="{{ asset('assets/img/common/ic_minus.svg') }}" alt="お気に入り" width="12" height="12" loading="lazy">
</a>
{% if Category.children|length > 0 %}
<ul>
{% for ChildCategory in Category.children %}
<li>
{{ tree(ChildCategory) }}
</li>
{% endfor %}
</ul>
{% endif %}
{% endif %}
</li>
{% endfor %}
</ul>
</div>
</div>