{#
特定のカテゴリから必要な個数呼び出します。
categoryID に呼び出したいカテゴリのIDを入れます。
例)120番のカテゴリを呼びたい
{% set categoryID = 120 %}
count に呼び出したい個数を入れます。
例)7個呼びたい
{% set count = 7 %}
※「全部呼ぶ」がわからないので、全部欲しいときはめっちゃでかい数入れてください。
99999 とか。
#}
{% set categoryID = 7 %}
{% set count = 8 %}
{% set Category = repository("Eccube\\Entity\\Category").find(categoryID) %}
{%
set Products = repository("Eccube\\Entity\\Product")
.getQueryBuilderBySearchData({'category_id':Category})
.setMaxResults(count)
.getQuery()
.getResult()
%}
{% if Products|length > 0 %}
<section class="ec-role">
<div class="ec-pickUpItemRole">
{# タイトルを変更してください。不要な場合は下記3行を削除 #}
<div class="ec-secHeading">
<h1 class="ec-secHeading__ja">{{ 'ピックアップ'|trans }}</h1>
</div>
<div class="ec-pickUpItemRole__list">
{% for Product in Products %}
<div class="ec-pickUpItemRole__listItem">
<a href="{{ url('product_detail', {'id': Product.id}) }}">
<img src="{{ asset(Product.main_list_image|no_image_product, 'save_image') }}">
<p class="ec-pickUpItemRole__listItemTitle">{{ Product.name }}</p>
<p class="ec-pickUpItemRole__listItemPrice">
{% if Product.hasProductClass %}
{% if Product.getPrice02Min == Product.getPrice02Max %}
{{ Product.getPrice02IncTaxMin|price }}
{% else %}
{{ Product.getPrice02IncTaxMin|price }} ~ {{ Product.getPrice02IncTaxMax|price }}
{% endif %}
{% else %}
{{ Product.getPrice02IncTaxMin|price }}
{% endif %}
</p>
</a>
</div>
{% endfor %}
</div>
{#<div class="more_btn"><a href="{{ url('product_list', {'category_id': Category.id}) }}">VIEW MORE ></a></div> #}
</div>
</section>
{% endif %}