{#
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.
#}
{% extends 'default_frame.twig' %}
{% set body_class = 'product_page' %}
{% set hasCategory = false %}
{% set request_uri = app.request.server.get('REQUEST_URI') %}
{% if 'name=' in request_uri and Category != "" %}
{% set RootCategory = Category.RootCategory %}
{% set hasCategory = true %}
{% set msg = "elseif 'name=' in request_uri and Category != ))" %}
{% elseif Category != "" %}
{% set RootCategory = Category.RootCategory %}
{% set hasCategory = true %}
{% set msg = "elseif Category != ))" %}
{% elseif 'name=' in request_uri %}
{% set hasCategory = false %}
{% set msg = "if 'name=' in request_uri" %}
{% else %}
{% set msg = "else" %}
{% endif %}
{% if hasCategory %}
{% set RootCategory = Category.RootCategory %}
{% endif %}
{% set prm2 = app.request.query.get('type') %}
{% set prm3 = app.request.query.get('category_id2') %}
{% set prm4 = app.request.query.get('category_id3') %}
{% set prm5 = app.request.query.get('category_id4') %}
{% set prm6 = app.request.query.get('category_id5') %}
{% set prm7 = app.request.query.get('tag_id') %}
{% set pm2 = cast_to_int(prm2) %}
{% set pm3 = cast_to_int(prm3) %}
{% set pm4 = cast_to_int(prm4) %}
{% set pm5 = cast_to_int(prm5) %}
{% set pm6 = cast_to_int(prm6) %}
{% set cn1 = app.request.query.get('name') %}
{% if prm2 == 0 and prm2 != "" %}
{% set cn2 = "ヴァイスシュヴァルツ," %}
{% elseif prm2 == 1 and prm2 != "" %}
{% set cn2 = "ポケモン," %}
{% else %}
{% set cn2 = "" %}
{% endif %}
{% set cn3 = get_category_name(pm3) %}
{% set cn4 = get_category_name(pm4) %}
{% set cn5 = get_category_name(pm5) %}
{% set cn6 = get_category_name(pm6) %}
{% if prm7 == 4 and prm7 != "" %}
{% set cn7 = "傷あり商品," %}
{% else %}
{% set cn7 = "" %}
{% endif %}
{% block javascript %}
<script>
eccube.productsClassCategories = {
{% for Product in pagination %}
"{{ Product.id|escape('js') }}": {{ class_categories_as_json(Product)|raw }}{% if loop.last == false %}, {% endif %}
{% endfor %}
};
$(function() {
// 表示件数を変更
$('.disp-number').change(function() {
var dispNumber = $(this).val();
$('#disp_number').val(dispNumber);
$('#pageno').val(1);
$("#form1").submit();
});
// 並び順を変更
$('.order-by').change(function() {
var orderBy = $(this).val();
$('#orderby').val(orderBy);
$('#pageno').val(1);
$("#form1").submit();
});
$('.add-cart').on('click', function(e) {
var $form = $(this).parents('li').find('form');
// 個数フォームのチェック
var $quantity = $form.parent().find('.quantity');
if ($quantity.val() < 1) {
$quantity[0].setCustomValidity('{{ 'front.product.invalid_quantity'|trans }}');
setTimeout(function() {
loadingOverlay('hide');
}, 100);
return true;
} else {
$quantity[0].setCustomValidity('');
}
e.preventDefault();
$.ajax({
url: $form.attr('action'),
type: $form.attr('method'),
data: $form.serialize(),
dataType: 'json',
beforeSend: function(xhr, settings) {
// Buttonを無効にする
$('.add-cart').prop('disabled', true);
}
}).done(function(data) {
// レスポンス内のメッセージをalertで表示
$.each(data.messages, function() {
$('#ec-modal-header').text(this);
});
$('.ec-modal').show()
// カートブロックを更新する
$.ajax({
url: '{{ url('block_cart') }}',
type: 'GET',
dataType: 'html'
}).done(function(html) {
$('.ec-headerRole__cart').html(html);
});
}).fail(function(data) {
alert('{{ 'front.product.add_cart_error'|trans }}');
}).always(function(data) {
// Buttonを有効にする
$('.add-cart').prop('disabled', false);
});
});
});
$('.ec-modal-wrap').on('click', function(e) {
// モーダル内の処理は外側にバブリングさせない
e.stopPropagation();
});
$('.ec-modal-overlay, .ec-modal, .ec-modal-close, .ec-inlineBtn--cancel').on('click', function() {
$('.ec-modal').hide()
});
{% if hasCategory %}
{% if RootCategory == "買い取り" or Category == "買い取り" %}
$('.bigbox').css('background-color','#22b573');
$('.header-middle').css('background-color','#22b573');
$('.side-searchbox').css('background-color','#22b573');
$('.side-cat-more').css('background-color','#22b573');
$('.side-cat-more2').css('background-color','#22b573');
$('.side-cat-more3').css('background-color','#22b573');
{% endif %}
{% endif %}
$(document).ready(function() {
// プラスボタンがクリックされたとき
$('.spinner-up').click(function() {
// 対応する数量フィールドのIDを取得
var productId = $(this).closest('.number-spinner-wrap').find('input[type="number"]').attr('id');
// 対応する数量フィールドの値を取得
var quantity = parseInt($('#' + productId).val());
// 値を増加させて数量フィールドに設定
$('#' + productId).val(quantity + 1);
});
// マイナスボタンがクリックされたとき
$('.spinner-down').click(function() {
// 対応する数量フィールドのIDを取得
var productId = $(this).closest('.number-spinner-wrap').find('input[type="number"]').attr('id');
// 対応する数量フィールドの値を取得
var quantity = parseInt($('#' + productId).val());
// 値を減少させて数量フィールドに設定 (1未満にはしない)
if (quantity > 1) {
$('#' + productId).val(quantity - 1);
}
});
});
</script>
{% endblock %}
{% block main %}
<div class="ec-layoutRole__mainTop">
<div class="top-content-box cat_mob_top-content-box">
{% if search_form.category_id.vars.errors|length > 0 %}
<div class="test">
<p class="errormsg text-danger">{{ 'front.product.search__category_not_found'|trans }}</p>
</div>
{% else %}
<div class="sort-big-box">
<h2>商品一覧</h2>
<div class="sort-box">
<!--<a href="{{ app.request.getUri }}&orderby=4">おすすめ順</a>-->
<a href="{{ app.request.getUri }}&orderby=2">新着順</a>
<a href="{{ app.request.getUri }}&orderby=1">価格の安い順</a>
<a href="{{ app.request.getUri }}&orderby=3">価格の高い順</a>
</div>
{% if cn1 is empty and cn2 is empty and cn3 is empty and cn4 is empty and cn5 is empty and cn6 is empty %}
{% else %}
<p class="search_res_text">検索ワード:{{ cn2 }}{{ cn3 }}{{ cn4 }}{{ cn5 }}{{ cn6 }}{{ cn7 }}{{ cn1 }}</p>
{% endif %}
</div>
<div class="product-big-list">
{% if pagination.totalItemCount > 0 %}
{% for Product in pagination %}
<div class="product-list-box">
{% if app.request.query.get('category_id') == 219 or app.request.query.get('category_id') == 218 %}
<img src="{{ asset(Product.main_list_image|no_image_product, 'save_image') }}">
{% else %}
<a href="{{ url('product_detail', {'id': Product.id}) }}">
<img src="{{ asset(Product.main_list_image|no_image_product, 'save_image') }}">
</a>
{% endif %}
<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">
{% if hasCategory %}
{% if RootCategory == "買い取り" or Category == "買い取り" %}
<input type="hidden" name="buyflg" value="1">
{% else %}
{% endif %}
{% endif %}
<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>
{% if hasCategory %}
{% if RootCategory == "買い取り" or Category == "買い取り" %}
<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 class="add-cart-custom" data-cartid="{{ Product.id }}" form="productForm{{ Product.id }}" type="submit"> カートに入れる </button>
</div>
{% endif %}
{% endif %}
{% else %}
<div class="cart-in-btn">
<button type="button" class="add-cart-custom" disabled="disabled"> {{ '品切れ中'|trans }} </button>
</div>
{% endif %}
</div>
<!--<li class="ec-shelfGrid__item">
<a href="{{ url('product_detail', {'id': Product.id}) }}">
<p class="ec-shelfGrid__item-image">
<img src="{{ asset(Product.main_list_image|no_image_product, 'save_image') }}" alt="{{ Product.name }}" {% if loop.index > 5 %} loading="lazy"{% endif %}>
</p>
<p>{{ Product.name }}</p>
{% if Product.description_list %}
<p>{{ Product.description_list|raw|nl2br }}</p>
{% endif %}
<p class="price02-default">
{% 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>
{% if Product.stock_find %}
{% set form = forms[Product.id] %}
<form name="form{{ Product.id }}" id="productForm{{ Product.id }}" action="{{ url('product_add_cart', {id:Product.id}) }}" method="post">
<div class="ec-productRole__actions">
{% if form.classcategory_id1 is defined %}
<div class="ec-select">
{{ form_widget(form.classcategory_id1) }}
{{ form_errors(form.classcategory_id1) }}
</div>
{% if form.classcategory_id2 is defined %}
<div class="ec-select">
{{ form_widget(form.classcategory_id2) }}
{{ form_errors(form.classcategory_id2) }}
</div>
{% endif %}
{% endif %}
<div class="ec-numberInput"><span>{{ 'common.quantity'|trans }}</span>
{{ form_widget(form.quantity, {'attr': {'class': 'quantity'}}) }}
{{ form_errors(form.quantity) }}
</div>
</div>
{{ form_rest(form) }}
</form>
<div class="ec-productRole__btn">
<button type="submit" class="ec-blockBtn--action add-cart" data-cartid="{{ Product.id }}" form="productForm{{ Product.id }}">
{{ 'front.product.add_cart'|trans }}
</button>
</div>
{% else %}
<div class="ec-productRole__btn">
<button type="button" class="ec-blockBtn--action" disabled="disabled">
{{ 'front.product.out_of_stock'|trans }}
</button>
</div>
{% endif %}
</li>-->
{% endfor %}
</div>
<div class="ec-modal">
<div class="ec-modal-overlay">
<div class="ec-modal-wrap">
<span class="ec-modal-close"><span class="ec-icon"><img src="{{ asset('assets/icon/cross-dark.svg') }}" alt=""/></span></span>
<div id="ec-modal-header" class="text-center">{{ 'front.product.add_cart_complete'|trans }}</div>
<div class="ec-modal-box">
<div class="ec-role">
<span class="ec-inlineBtn--cancel">{{ 'front.product.continue'|trans }}</span>
<a href="{{ url('cart') }}" class="ec-inlineBtn--action">{{ 'common.go_to_cart'|trans }}</a>
</div>
</div>
</div>
</div>
</div>
<div class="ec-pagerRole">
{% include "pager.twig" with {'pages': pagination.paginationData} %}
</div>
{% endif %}
{% endif %}
</div>
</div>
{% endblock %}