{#This file is part of EC-CUBECopyright(c) EC-CUBE CO.,LTD. All Rights Reserved.http://www.ec-cube.co.jp/For the full copyright and license information, please view the LICENSEfile that was distributed with this source code.#}<div class="top-content-box"> <h2>ポケモン おすすめカード</h2>{% set Category = repository("Eccube\\Entity\\Category").find(645) %}{% set products = repository("Eccube\\Entity\\Product") .getQueryBuilderBySearchData({'category_id': Category}) .setMaxResults(5) .getQuery() .getResult()%} <div class="product-big-list">{% for Product in products %} <div class="product-list-box"> <a href="{{ url('product_detail', {'id': Product.id}) }}"> <img src="{{ asset(Product.main_list_image|no_image_product, 'save_image') }}"> </a> <p>{{ Product.name }}</p> <p class="price"> {% if Product.hasProductClass %} {% if Product.getPrice02Min == Product.getPrice02Max %} {{ Product.getPrice02IncTaxMin|number_format }} {% else %} {{ Product.getPrice02IncTaxMin|number_format }} ~ {{ Product.getPrice02IncTaxMax|number_format }} {% endif %} {% else %} {{ Product.getPrice02IncTaxMin|number_format }} {% endif %} <span>円</span> </p> {% if Product.stock_find %} <div class="top-poke-spin"> <form name="form{{ Product.id }}" id="productForm{{ Product.id }}" action="{{ url('product_add_cart', {id:Product.id}) }}" method="post"> <label class="number-spinner-wrap"> <input type="number" id="quantity{{ Product.id }}" name="quantity" required="required" min="1" maxlength="9" class="test5" value="1"> <span class="spinner spinner-down"> <img src="{{ asset('/html/user_data/assets/img/minus.png') }}" class="numcursul" alt=""> </span> <span class="spinner spinner-up"> <img src="{{ asset('/html/user_data/assets/img/plus.png') }}" class="numcursul" alt=""> </span> </label> <input type="hidden" id="product_id{{ Product.id }}" name="product_id" value="{{ Product.id }}"> <input type="hidden" id="ProductClass" name="ProductClass" value="{{ Product.ProductClasses[0].id }}"> <input type="hidden" id="_token{{ Product.id }}" name="_token" value="{{ csrf_token('Eccube\\Form\\Type\\AddCartType') }}" /> </form> </div> <div class="cart-in-btn"> <button class="add-cart-custom" data-cartid="{{ Product.id }}" form="productForm{{ Product.id }}" type="submit"> カートに入れる </button> </div> {% else %} <div class="cart-in-btn"> <button type="button" class="add-cart-custom" disabled="disabled"> {{ '品切れ中'|trans }} </button> </div> {% endif %} </div>{% endfor %} </div></div><script>$(document).ready(function() { // プラスボタンがクリックされたとき $('.top-poke-spin .spinner-up').click(function() { // 対応する数量フィールドのIDを取得 var productId = $(this).closest('.top-poke-spin .number-spinner-wrap').find('input[type="number"]').attr('id'); // 対応する数量フィールドの値を取得 var quantity = parseInt($('.top-poke-spin #' + productId).val()); // 値を増加させて数量フィールドに設定 $( '.top-poke-spin #' + productId).val(quantity + 1); }); // マイナスボタンがクリックされたとき $('.top-poke-spin .spinner-down').click(function() { // 対応する数量フィールドのIDを取得 var productId = $(this).closest('.top-poke-spin .number-spinner-wrap').find('input[type="number"]').attr('id'); // 対応する数量フィールドの値を取得 var quantity = parseInt($('.top-poke-spin #' + productId).val()); // 値を減少させて数量フィールドに設定 (1未満にはしない) if (quantity > 1) { $( '.top-poke-spin #' + productId).val(quantity - 1); } });});</script>