{#
おすすめ商品などの商品一覧を表示するカルーセル
ex. 当店のイチオシ! ブレーカおすすめ商品
@param string $label ブロックのタイトル
@param int $category_id カテゴリID
#}
{% set Category = repository("Eccube\\Entity\\Category").find(category_id) %}
{%
set Products = repository("Eccube\\Entity\\Product")
.getQueryBuilderBySearchData({'category_id':Category})
.setMaxResults(16)
.getQuery()
.getResult()
%}
<div class="recommend-item-root">
<h2 class="heading-section heading-section--with-border">{{ label }}</h2>
<div class="px-md-0 recommend-item-container">
<div class="g-4 carousel js-carousel">
{% if Products %}
{% for p in Products %}
<a href="{{ url('product_detail', {'id': p.id}) }}" class="recommend-item">
<div>
<img src="{{ asset(p.main_list_image|no_image_product, 'save_image') }}" class="recommend-item__image" alt="{{ p.name }}">
</div>
<p class="recommend-item__title">{{ p.name|striptags }}</p>
<p class="recommend-item__price">
{% if p.hasProductClass %}
{% if p.getPrice02Min == p.getPrice02Max %}
{{ p.getPrice02IncTaxMin|price }}
{% else %}
{{ p.getPrice02IncTaxMin|price }} ~ {{ p.getPrice02IncTaxMax|price }}
{% endif %}
{% else %}
{{ p.getPrice02IncTaxMin|number_format }}<span class="recommend-item__yen">円</span>
{% endif %}
</p>
</a>
{% endfor %}
{% endif %}
</div>
</div>
</div>