{#
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.
#}
{% block stylesheet %}
<style>
.stamps-listItem {
margin: 10px 0;
}
.stamps-top-buttons {
width: 100%;
}
.ec-newItemRole .ec-newItemRole__listItemTitle {
font-size: 20px;
}
.ec-newItemRole .ec-newItemRole__listItemPrice{
font-size: 20px;
}
</style>
{% endblock %}
{% block javascript %}
<script>
$(function() {
$('.add-cart').on('click', function(e) {
var $form = $(this).parent();
// 個数チェック
var $quantity = $form.children().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').html(this);
});
$('#ec-modal-checkbox').prop('checked', true);
// カートブロックを更新する
$.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);
});
});
});
</script>
{% endblock %}
<div class="ec-role">
<div class="ec-newItemRole">
<div class="ec-newItemRole__list">
<div class="row">
<div class="col-12">
<div class="row">
{% for Product in products %}
<div class="col-xs-12 col-md-6 stamps-listItem">
{# 商品画像 #}
<a href="{{ url('product_detail', {'id': Product.id}) }}">
<img src="{{ asset(Product.main_list_image|no_image_product, 'save_image') }}">
</a>
{# 商品名 #}
<a href="{{ url('product_detail', {'id': Product.id}) }}">
<p class="ec-newItemRole__listItemTitle">{{ Product.name }}</p>
</a>
{# 商品価格 #}
<p class="ec-newItemRole__listItemPrice">
{% 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>
<div class="row">
<div class="col-lg-6">
{# カート投入ボタン #}
{% 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, {'type': 'hidden', 'attr': {'class': 'quantity'}}) }}
{{ form_errors(form.quantity) }}
</div>
</div>
{{ form_rest(form) }}
<input type="image" src="{{ asset('assets/imgs/button-cart.png','user_data') }}" class="add-cart stamps-top-buttons" data-cartid="{{ Product.id }}" form="productForm{{ Product.id }}" style="" onClick="">
</form>
</div>
<div class="col-lg-6">
{# 「レポートを見る」ボタン #}
<a href="{{ url('product_detail', {'id': Product.id}) }}#report">
<img src="{{ asset('assets/imgs/button-report.png','user_data') }}" class="go-report stamps-top-buttons" style="" onClick=""/>
</a>
</a>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
</div>
</div>
</div>
<div class="ec-modal">
<input type="checkbox" id="ec-modal-checkbox" class="checkbox">
<div class="ec-modal-overlay">
<label for="ec-modal-checkbox" class="ec-modal-overlay-close"></label>
<div class="ec-modal-wrap">
<label for="ec-modal-checkbox" class="ec-modal-close"><span class="ec-icon"><img src="{{ asset('assets/icon/cross-dark.svg') }}" alt=""/></span></label>
<div id="ec-modal-header" class="text-center">{{ 'front.product.add_cart_complete'|trans }}</div>
<div class="ec-modal-box">
<div class="ec-role">
<label for="ec-modal-checkbox" class="ec-inlineBtn--cancel">{{ 'front.product.continue'|trans }}</label>
<a href="{{ url('cart') }}" class="ec-inlineBtn--action">{{ 'common.go_to_cart'|trans }}</a>
</div>
</div>
</div>
</div>
</div>