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

Open in your IDE?
  1. {#
  2. This file is part of EC-CUBE
  3. Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  4. http://www.ec-cube.co.jp/
  5. For the full copyright and license information, please view the LICENSE
  6. file that was distributed with this source code.
  7. #}
  8. <div class="top-content-box">
  9.     <h2>こちらの商品もおすすめ</h2>
  10. {% set Category = repository("Eccube\\Entity\\Category").find(429) %}
  11. {%
  12.     set products = repository("Eccube\\Entity\\Product")
  13.     .getQueryBuilderBySearchData({'category_id': Category})
  14.     .setMaxResults(5)
  15.     .getQuery()
  16.     .getResult()
  17. %}
  18.     <div class="product-big-list">
  19. {% for Product in products %}
  20.         <div class="product-list-box">
  21.             <a href="{{ url('product_detail', {'id': Product.id}) }}">
  22.                 <img src="{{ asset(Product.main_list_image|no_image_product, 'save_image') }}">
  23.             </a>
  24.             <p>{{ Product.name }}</p>
  25.             <p class="price">
  26.                 {% if Product.hasProductClass %}
  27.                     {% if Product.getPrice02Min == Product.getPrice02Max %}
  28.                         {{ Product.getPrice02IncTaxMin|number_format }}
  29.                     {% else %}
  30.                         {{ Product.getPrice02IncTaxMin|number_format }} ~ {{ Product.getPrice02IncTaxMax|number_format }}
  31.                     {% endif %}
  32.                 {% else %}
  33.                     {{ Product.getPrice02IncTaxMin|number_format }}
  34.                 {% endif %}
  35.                 <span>円</span>
  36.             </p>
  37.             {% if Product.stock_find %}
  38.                 <form name="form{{ Product.id }}" id="productForm{{ Product.id }}" action="{{ url('product_add_cart', {id:Product.id}) }}" method="post">
  39.                     <label class="number-spinner-wrap">
  40.                         <input type="number" id="quantity{{ Product.id }}" name="quantity" required="required" min="1" maxlength="9" class="test5" value="1">
  41.                         <span class="spinner spinner-down"> <img src="{{ asset('/html/user_data/assets/img/minus.png') }}" class="numcursul" alt=""> </span>
  42.                         <span class="spinner spinner-up"> <img src="{{ asset('/html/user_data/assets/img/plus.png') }}" class="numcursul" alt=""> </span>
  43.                     </label>
  44.                     <input type="hidden" id="product_id{{ Product.id }}" name="product_id" value="{{ Product.id }}">
  45.                     <input type="hidden" id="ProductClass" name="ProductClass" value="{{ Product.ProductClasses[0].id }}">
  46.                     <input type="hidden" id="_token{{ Product.id }}" name="_token" value="{{ csrf_token('Eccube\\Form\\Type\\AddCartType') }}" />
  47.                 </form>
  48.                 <div class="cart-in-btn">
  49.                     <button class="add-cart-custom" data-cartid="{{ Product.id }}" form="productForm{{ Product.id }}" type="submit"> カートに入れる </button>
  50.                 </div>
  51.             {% else %}
  52.                 <div class="cart-in-btn">
  53.                     <button type="button" class="add-cart-custom" disabled="disabled"> {{ '品切れ中'|trans }} </button>
  54.                 </div>
  55.             {% endif %}
  56.         </div>
  57. {% endfor %}
  58.     </div>
  59. </div>
  60. <script>
  61. const $wrap = document.querySelector('.number-spinner-wrap')
  62. const $input = $wrap.querySelector('input')
  63. $wrap.querySelector('.spinner-down').onclick = ()=>{
  64.   $input.stepDown()
  65. }
  66. $wrap.querySelector('.spinner-up').onclick = ()=>{
  67.   $input.stepUp()
  68. }
  69. </script>