{#
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' %}
{% block stylesheet %}
<style>
.slick-slider {
margin-bottom: 30px;
}
.slick-dots {
position: absolute;
bottom: -45px;
display: block;
width: 100%;
padding: 0;
list-style: none;
text-align: center;
}
.slick-dots li {
position: relative;
display: inline-block;
width: 20px;
height: 20px;
margin: 0 5px;
padding: 0;
cursor: pointer;
}
.slick-dots li button {
font-size: 0;
line-height: 0;
display: block;
width: 20px;
height: 20px;
padding: 5px;
cursor: pointer;
color: transparent;
border: 0;
outline: none;
background: transparent;
}
.slick-dots li button:hover,
.slick-dots li button:focus {
outline: none;
}
.slick-dots li button:hover:before,
.slick-dots li button:focus:before {
opacity: 1;
}
.slick-dots li button:before {
content: " ";
line-height: 20px;
position: absolute;
top: 0;
left: 0;
width: 12px;
height: 12px;
text-align: center;
opacity: .25;
background-color: black;
border-radius: 50%;
}
.slick-dots li.slick-active button:before {
opacity: .75;
background-color: black;
}
.slick-dots li button.thumbnail img {
width: 0;
height: 0;
}
</style>
{% endblock %}
{% block javascript %}
<script>
eccube.classCategories = {{ class_categories_as_json(Product)|raw }};
{% if form.classcategory_id2 is defined %}
eccube.checkStock($('#form1'), {{ Product.id }}, {{ form.classcategory_id1.vars.value|json_encode|raw }}, {{ form.classcategory_id2.vars.value|json_encode|raw }});
{% elseif form.classcategory_id1 is defined %}
eccube.checkStock($('#form1'), {{ Product.id }}, {{ form.classcategory_id1.vars.value|json_encode|raw }}, null);
{% endif %}
</script>
<script>
$(function() {
// bfcache無効化
$(window).bind('pageshow', function(event) {
if (event.originalEvent.persisted) {
location.reload(true);
}
});
$('.item_visual').slick({
dots: false,
arrows: false,
responsive: [{
breakpoint: 768,
settings: {
dots: true
}
}]
});
$('.slideThumb').on('click', function() {
var index = $(this).attr('data-index');
$('.item_visual').slick('slickGoTo', index, false);
})
});
</script>
<script>
$(function() {
$('.add-cart').on('click', function(event) {
{% if form.classcategory_id1 is defined %}
// 規格1フォームの必須チェック
if ($('#classcategory_id1').val() == '__unselected' || $('#classcategory_id1').val() == '') {
$('#classcategory_id1')[0].setCustomValidity('{{ '項目が選択されていません'|trans }}');
return true;
} else {
$('#classcategory_id1')[0].setCustomValidity('');
}
{% endif %}
{% if form.classcategory_id2 is defined %}
// 規格2フォームの必須チェック
if ($('#classcategory_id2').val() == '__unselected' || $('#classcategory_id2').val() == '') {
$('#classcategory_id2')[0].setCustomValidity('{{ '項目が選択されていません'|trans }}');
return true;
} else {
$('#classcategory_id2')[0].setCustomValidity('');
}
{% endif %}
event.preventDefault();
const $form = $('#form1');
$.ajax({
url: $form.attr('action'),
type: $form.attr('method'),
data: $form.serialize(),
dataType: 'json',
beforeSend: function() {
$('.add-cart').prop('disabled', true);
}
}).done(function(data) {
console.log('AJAX succeeded', data);
// モーダルにメッセージを表示
if (data.messages) {
$('#ec-modal-header').html(data.messages.join('<br>'));
} else {
$('#ec-modal-header').html('{{ "カートに追加しました。"|trans }}');
}
// モーダルを表示
$('#cart-modal').addClass('active');
// カートブロックを更新
$.ajax({
url: "{{ url('block_cart') }}",
type: 'GET',
dataType: 'html'
}).done(function(html) {
$('.ec-headerRole__cart').html(html);
}).fail(function() {
alert('{{ "カートブロックの更新に失敗しました。"|trans }}');
});
}).fail(function() {
alert('{{ "カートへの追加に失敗しました。"|trans }}');
}).always(function() {
$('.add-cart').prop('disabled', false);
});
});
// モーダルを閉じる処理
$('#cart-modal-close, #continue-shopping').on('click', function() {
$('#cart-modal').removeClass('active');
});
});
</script>
{% endblock %}
{% block main %}
<div class="ec-productRole">
<div class="ec-grid2">
<div class="ec-grid2__cell">
<div class="ec-sliderItemRole">
<div class="item_visual">
{% for ProductImage in Product.ProductImage %}
<div class="slide-item"><img src="{{ asset(ProductImage, 'save_image') }}"></div>
{% else %}
<div class="slide-item"><img src="{{ asset(''|no_image_product, 'save_image') }}"/></div>
{% endfor %}
</div>
<div class="item_nav">
{% for ProductImage in Product.ProductImage %}
<div class="slideThumb" data-index="{{ loop.index0 }}"><img src="{{ asset(ProductImage, 'save_image') }}"></div>
{% endfor %}
</div>
</div>
</div>
<div class="ec-grid2__cell">
<div class="ec-productRole__profile">
{# 商品名 #}
<div class="ec-productRole__title">
<h2 class="ec-headingTitle">{{ Product.name }}</h2>
</div>
{# タグ #}
<ul class="ec-productRole__tags">
{% for Tag in Product.Tags %}
<li class="ec-productRole__tag tag_{{ Tag.id }}">{{ Tag }}</li>
{% endfor %}
</ul>
{# 販売価格 #}
<div class="ec-productRole__price">
{% if Product.hasProductClass -%}
{% set isDeliveryFree = Product.ProductClasses|filter(pc => pc.isDeliveryFree())|length > 0 %}
{% if Product.getPrice02IncTaxMin == Product.getPrice02IncTaxMax %}
<div class="ec-price">
<span class="ec-price__price price02-default">{{ Product.getPrice02IncTaxMin|price }}</span>
<span class="ec-price__tax">
{{ '税込'|trans }}
{% if isDeliveryFree %}
<span class="delivery-free">{{ ' 送料無料'|trans }}</span>
{% else %}
<span class="delivery-fee">{{ ' +送料'|trans }}</span>
{% endif %}
</span>
</div>
{% else %}
<div class="ec-price">
<span class="ec-price__price price02-default">{{ Product.getPrice02IncTaxMin|price }} ~ {{ Product.getPrice02IncTaxMax|price }}</span>
<span class="ec-price__tax">
{{ '税込'|trans }}
{% if isDeliveryFree %}
<span class="delivery-free">{{ ' 送料無料'|trans }}</span>
{% else %}
<span class="delivery-fee">{{ ' +送料'|trans }}</span>
{% endif %}
</span>
</div>
{% endif %}
{% else %}
<div class="ec-price">
<span class="ec-price__price">{{ Product.getPrice02IncTaxMin|price }}</span>
<span class="ec-price__tax">
{{ '税込'|trans }}
{% set isDeliveryFree = Product.ProductClasses|filter(pc => pc.isDeliveryFree())|length > 0 %}
{% if isDeliveryFree %}
<span class="delivery-free">{{ ' 送料無料'|trans }}</span>
{% else %}
<span class="delivery-fee">{{ ' +送料'|trans }}</span>
{% endif %}
</span>
</div>
{% endif %}
</div>
{# 関連カテゴリ #}
{% if Product.ProductCategories is not empty %}
<div class="ec-productRole__category">
<div>{{ '関連カテゴリ'|trans }}</div>
{% for ProductCategory in Product.ProductCategories %}
<ul>
<li>
{% for Category in ProductCategory.Category.path %}
<a href="{{ url('product_list') }}?category_id={{ Category.id }}">{{ Category.name }}</a> {%- if loop.last == false %}
<span>></span>{% endif -%}
{% endfor %}
</li>
</ul>
{% endfor %}
</div>
{% endif %}
<form action="{{ url('product_add_cart', {id:Product.id}) }}" method="post" id="form1" name="form1">
{% if Product.stock_find %}
<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-select">
{{ form_widget(form.quantity) }}
{{ form_errors(form.quantity) }}
</div>
</div>
<div class="ec-productRole__btn">
<button type="submit" class="ec-blockBtn--action add-cart">
{{ 'カートに入れる'|trans }}
</button>
</div>
{% else %}
<div class="ec-productRole__btn">
<button type="button" class="ec-blockBtn--action" disabled="disabled">
{{ '品切れ中です'|trans }}
</button>
</div>
{% endif %}
{{ form_rest(form) }}
</form>
<!-- モーダル -->
<div class="ec-modal" id="cart-modal">
<div class="ec-modal-overlay">
<div class="ec-modal-wrap">
<button class="ec-modal-close" id="cart-modal-close">
<span class="ec-icon"><img src="{{ asset('assets/icon/cross-dark.svg') }}" alt="閉じる"/></span>
</button>
<div id="ec-modal-header" class="text-center">{{ 'カートに追加しました。'|trans }}</div>
<div class="ec-modal-box">
<div class="ec-role">
<button class="ec-inlineBtn--cancel" id="continue-shopping">{{ 'お買い物を続ける'|trans }}</button>
<a href="{{ url('cart') }}" class="ec-inlineBtn--action">{{ 'カートへ進む'|trans }}</a>
</div>
</div>
</div>
</div>
</div>
<div class="ec-productRole__description">{{ Product.description_detail|raw|nl2br }}
</div>
</div>
</div>
</div>
{# スペック #}
<div class="makerspec pull-left">
<table>
<tbody>
{% for spec in Product.ProductMakerSpec %}
<tr>
<th><span>{{spec.getSpecName()}}</span></th>
<td class="txt"><span>{{spec.getInfo()}}</span></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="instant-repair-description">
{#<div class="instant-repair-description__title">
プリンタストアの検品
</div>#}
<div class="uk-child-width-1-1" uk-grid>
<div class="instant-repair-description__message">
<div class="uk-card uk-card-default uk-card-small uk-card-body">
<h3 class="uk-card-title">商品の品質</h3>
<p>プリンタストアでは、プリンタの機種ごとに専門のサービスマンがおります。</p>
<p>必要に応じて分解・清掃・グリスアップ・部品交換を行い、快適にご使用頂けるよう万全の調整を整えております。</p>
<p>プリンタストアの商品には全て30日間の保証が付いておりますので安心してご使用頂けます。</p>
</div>
</div>
</div>
<div class="instant-repair-description__image">
<div class="uk-card uk-card-default uk-card-small uk-card-body">
<img src="{{ asset('assets/img/product/mente01.jpg') }}" alt="">
</div>
</div>
</div>
<div class="ec-productRole__contact">
<div class="ec-productRole__contact__title">
<span>この商品について問い合わせる</span>
</div>
<form action="{{ path('contact') }}" method="post" class="h-adr" novalidate>
<span class="p-country-name" style="display:none;">Japan</span>
{{ form_widget(contactform._token) }}
<p class="ec-para-normal">{{ '内容によっては回答をさしあげるのにお時間をいただくこともございます。
また、休業日は翌営業日以降の対応となりますのでご了承ください。
'|trans|nl2br }}</p>
<div class="ec-RegisterRole__actions">
<div class="ec-off4Grid">
<div class="ec-off4Grid__cell">
<a href="/contact" class="ec-blockBtn--action">
{{ 'お問い合わせ'|trans }}
</a>
</div>
</div>
</div>
</form>
</div>
{% if Product.freearea %}
<div class="ec-productRole__description">
{{ include(template_from_string(Product.freearea)) }}
</div>
{% endif %}
</div>
{% endblock %}