{#
おすすめ商品などの商品一覧を表示するカルーセル
ex. 当店のイチオシ! ブレーカおすすめ商品
@param string $label ブロックのタイトル
@param string $href_label ブロックのリンクテキスト
SCSS: /html/template/default/assets/scss/bluewood/twig/_category-list.scss
#}
{% set request_uri = app.request.server.get('REQUEST_URI') %}
{% set category_ids = [5, 6, 9, 11, 12, 13, 14, 15, 16, 18, 19, 20, 21, 22, 24, 25, 26, 28, 29, 30, 32, 34, 35] %}
{% set Categories = repository("Eccube\\Entity\\Category")
.createQueryBuilder('c')
.where('c.id IN (:category_ids)')
.setParameter('category_ids', category_ids)
.getQuery()
.getResult() %}
<section>
{% if label %}
<div class="heading_with_search_icon heading_with_search_icon--list-page">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M10.875 18.75C15.2242 18.75 18.75 15.2242 18.75 10.875C18.75 6.52576 15.2242 3 10.875 3C6.52576 3 3 6.52576 3 10.875C3 15.2242 6.52576 18.75 10.875 18.75Z" stroke="#CF0800" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M16.4424 16.4434L20.9986 20.9997" stroke="#CF0800" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
<h2 class="heading_with_search_icon__text">{{ label }}</h2>
</div>
{% endif %}
<div class="grid-container">
{% for c in Categories %}
{% set path = asset('assets/img/category/category-img-' ~ c.id ~ '.jpg', "user_data") %}
<div class="grid-item">
<a href="{{ url('product_list') }}?category_id={{c.id}}" class="category-list-item">
<img src="{{path}}" alt="{{ c.name }}" width="60" height="60" class="category-list-item__img">
<div class="category-list-item__label">{{ c.name }}</div>
</a>
</div>
{% endfor %}
</div>
<div class="d-flex justify-content-center">
<button type="button" id="js-collapse" class="sercah-by-category">
<span>{{ href_label }}</span>
<span
class="sercah-by-category__icon"
>
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M6 3L11 8L6 13" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/
>
</svg>
</span>
</a>
</div>
</section>
{% block javascript %}
<script>
// カテゴリ一覧から探すを押した時に全てのカテゴリを表示する
$(document).ready(function() {
$('.grid-item').hide();
$('.grid-item:lt(12)').show();
$('#js-collapse').on('click', () => {
$('.grid-item').show();
$('#js-collapse').hide();
});
});
</script>
{% endblock %}