app/template/default/Block/recommend_list.twig line 1

Open in your IDE?
  1. {#
  2. おすすめ商品などの商品一覧を表示するカルーセル
  3. ex. 当店のイチオシ! ブレーカおすすめ商品
  4. @param string $label ブロックのタイトル
  5. @param int $category_id カテゴリID
  6. #}
  7. {% set Category = repository("Eccube\\Entity\\Category").find(category_id) %}
  8. {% 
  9. set Products = repository("Eccube\\Entity\\Product")
  10. .getQueryBuilderBySearchData({'category_id':Category})
  11. .setMaxResults(16)
  12. .getQuery()
  13. .getResult()
  14. %}
  15. <div class="recommend-item-root">
  16.     <h2 class="heading-section heading-section--with-border">{{ label }}</h2>
  17.     <div class="px-md-0 recommend-item-container">
  18.         <div class="g-4 carousel js-carousel">
  19.             {% if Products %}
  20.             {% for p in Products %}
  21.                 <a href="{{ url('product_detail', {'id': p.id}) }}" class="recommend-item">
  22.                     <div>
  23.                         <img src="{{ asset(p.main_list_image|no_image_product, 'save_image') }}" class="recommend-item__image" alt="{{ p.name }}">
  24.                     </div>
  25.                     
  26.                     <p class="recommend-item__title">{{ p.name|striptags }}</p>
  27.                     <p class="recommend-item__price">
  28.                         {% if p.hasProductClass %}
  29.                             {% if p.getPrice02Min == p.getPrice02Max %}
  30.                                 {{ p.getPrice02IncTaxMin|price }}
  31.                             {% else %}
  32.                                 {{ p.getPrice02IncTaxMin|price }} ~ {{ p.getPrice02IncTaxMax|price }}
  33.                             {% endif %}
  34.                             {% else %}
  35.                                 {{ p.getPrice02IncTaxMin|number_format }}<span class="recommend-item__yen">円</span>
  36.                         {% endif %}
  37.                     </p>
  38.                 </a>
  39.             {% endfor %}
  40.             {% endif %}
  41.         </div>
  42.     </div>
  43. </div>