{#
This file is part of EC-CUBE
Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
http://www.ec-cube.co.jp/
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
#}
<div class="mob_top-content-box">
<h2>ポケモンおすすめカード</h2>
{% set Category = repository("Eccube\\Entity\\Category").find(8) %}
{%
set products = repository("Eccube\\Entity\\Product")
.getQueryBuilderBySearchData({'category_id': Category})
.setMaxResults(4)
.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 %}
<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 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>
const $wrap = document.querySelector('.number-spinner-wrap')
const $input = $wrap.querySelector('input')
$wrap.querySelector('.spinner-down').onclick = ()=>{
$input.stepDown()
}
$wrap.querySelector('.spinner-up').onclick = ()=>{
$input.stepUp()
}
</script>