{#
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: 12px;
}
.item_visual{
opacity: 0;
transition: opacity .3s linear;
}
.item_visual.slick-initialized.slick-slider{
opacity: 1;
}
.item_visual .slide-item:focus,
.item_visual .slide-item:focus-visible{
outline: none;
}
#colorbox #cboxContent {
background-color: transparent;
padding: 8px 70px;
}
#cboxOverlay{
background: hsla(0,0%,88.6%,.9);
}
#cboxContent,
#cboxLoadedContent{
background: transparent;
border: none;
}
.cboxPhoto{
border-radius: 4px;
}
#cboxPrevious,
#cboxNext{
position: absolute;
top: 50%;
background: #fff;
padding: 10px;
border-radius: 50px;
width: 40px;
height: 40px;
z-index: 100;
}
#cboxPrevious{
left: 0px;
}
#cboxPrevious::before{
content: "";
display: inline-block;
padding: 3px;
margin: 0 10px;
border-left: 2px solid #000;
border-bottom: 2px solid #000;
transform: rotate(45deg);
position: absolute;
top: 15px;
left: 8px;
}
#cboxNext{
right: 0px;
}
#cboxNext::before{
content: "";
display: inline-block;
padding: 3px;
margin: 0 10px;
border-top: 2px solid #000;
border-right: 2px solid #000;
transform: rotate(45deg);
position: absolute;
top: 15px;
right: 8px;
}
#cboxSlideshow{
display: none;
}
#cboxClose{
background: #fff;
padding: 10px;
border-radius: 50px;
top: -10px;
right: 0px;
width: 40px;
height: 40px;
cursor: pointer;
display: block;
}
#cboxClose::before,
#cboxClose::after{
content: "";
display: block;
background-color: #000;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
width: 1.25vw;
height: 1px;
}
#cboxClose::before{
transform: rotate(45deg);
}
#cboxClose::after{
transform: rotate(-45deg);
}
#cboxCloseSP{
display: none;
}
@media only screen and (max-width: 767px) {
.item_visual a:hover{
opacity: 1;
outline: none;
}
#colorbox #cboxContent{
padding: 0;
}
#cboxClose{
display: none;
}
#cboxClose::before,
#cboxClose::after{
width: 5vw;
}
#cboxPrevious,
#cboxNext{
display: none!important;
}
#cboxCloseSP{
display: block;
position: absolute;
background: #fff;
padding: 10px;
border-radius: 50px;
border: none;
width: 40px;
height: 40px;
cursor: pointer;
top: 10px;
right: 10px;
z-index: 9999;
}
#cboxCloseSP::before,
#cboxCloseSP::after{
content: "";
display: block;
background-color: #000;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
width: 5vw;
height: 1px;
}
#cboxCloseSP::before{
transform: rotate(45deg);
}
#cboxCloseSP::after{
transform: rotate(-45deg);
}
}
</style>
{% endblock %}
{% block javascript %}
<script>
eccube.classCategories = {{ class_categories_as_json(Product)|raw }};
// 規格2に選択肢を割り当てる。
function fnSetClassCategories(form, classcat_id2_selected) {
var $form = $(form);
var product_id = $form.find('input[name=product_id]').val();
var $sele1 = $form.find('select[name=classcategory_id1]');
var $sele2 = $form.find('select[name=classcategory_id2]');
eccube.setClassCategories($form, product_id, $sele1, $sele2, classcat_id2_selected);
}
{% if form.classcategory_id2 is defined %}
fnSetClassCategories(
$('#form1'), {{ 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() {
$('.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 %}
// 個数フォームのチェック
if ($('#quantity').val() < 1) {
$('#quantity')[0].setCustomValidity('{{ '1以上で入力してください。'|trans }}');
return true;
} else {
$('#quantity')[0].setCustomValidity('');
}
event.preventDefault();
$form = $('#form1');
$.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('{{ 'カートへの追加に失敗しました。'|trans }}');
}).always(function(data) {
// Buttonを有効にする
$('.add-cart').prop('disabled', false);
});
});
});
$('.ec-modal-overlay, .ec-modal .ec-inlineBtn--cancel').on('click', function() {
$('.ec-modal').hide()
});
</script>
<script>
$(function() {
// bfcache無効化
$(window).bind('pageshow', function(event) {
if (event.originalEvent.persisted) {
location.reload(true);
}
});
$('.item_visual').slick({
dots: false,
arrows: false,
infinite: false,
});
$('.slideThumb:first-child').addClass("is-current");
$('.slideThumb').on('click', function() {
var index = $(this).attr('data-index');
var visual = $('.slideThumb');
$(visual).removeClass("is-current");
$(this).addClass("is-current");
$('.item_visual').slick('slickGoTo', index, false);
});
});
</script>
<script src="{{ asset('assets/js/jquery.colorbox-min.js') }}"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.touchswipe/1.6.19/jquery.touchSwipe.min.js"></script>
<script>
$(document).bind('cbox_open', function(){
var test = document.getElementById('colorbox');
test.insertAdjacentHTML('beforebegin','<button type="button" id="cboxCloseSP"></button>');
if(!navigator.userAgent.match(/(iPhone|iPad|iPod|Android)/)) {
$('#cboxCloseSP').on('click', function(){
$.colorbox.close();
$("#cboxCloseSP").remove();
});
$('#colorbox').swipe({
swipeLeft:function(){
$.colorbox.next()
},
swipeRight:function(){
$.colorbox.prev()
},
threshold:0
});
}
return false;
});
$(document).ready(function(){
if(!navigator.userAgent.match(/(iPhone|iPad|iPod|Android)/)) {
$("#cboxCurrent").remove();
$(".gallery-slide").colorbox({
rel:'slideshow',
maxWidth:"90%",
maxHeight:"90%",
opacity: 0.7,
overlayClose: true,
returnFocus:false,
onOpen:function() {
var ycoord = $(this).scrollTop();
$('#colorbox').data('ycoord',ycoord);
ycoord = ycoord * -1;
$('body').css('position','fixed').css('left','0px').css('right','0px').css('top',ycoord + 'px');
},
onClosed:function(){
$('#cboxOverlay').removeClass('customization');
$('body').css('position','').css('left','auto').css('right','auto').css('top','auto');
$(window).scrollTop($('#colorbox').data('ycoord'));
},
onComplete: function() {
$.colorbox.position(0);
}
});
$('.gallery-slide').on('click', function(){
$('#cboxOverlay').addClass('customization');
});
}
return false;
});
$('.gallery-slide').on('click', function(){
if(window.matchMedia("(max-width: 768px)").matches){
return false;
}
});
</script>
{% endblock %}
{% block main %}
<link rel="stylesheet" href="{{ asset('assets/js/colorbox/colorbox.css') }}">
<div class="ec-productRole">
{# タグ #}
<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__title">
<h2 class="ec-headingTitle">{{ Product.name }}</h2>
</div>
<div class="ec-grid2">
<div class="ec-grid2__cell">
<div class="ec-sliderItemRole">
<div class="item_visual">
{% for ProductImage in Product.ProductImage %}
<a href="{{ asset(ProductImage, 'save_image') }}" class="gallery-slide">
<div class="slide-item">
<img src="{{ asset(ProductImage, 'save_image') }}">
<div class="icon_zoom"><img src="{{ asset('assets/icon/icon_zoom.svg') }}"></div>
</div>
</a>
{% 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">
{# 通常価格 #}
{% if Product.hasProductClass -%}
<div class="ec-productRole__priceRegular">
{% if Product.getPrice01Min is not null and Product.getPrice01IncTaxMin == Product.getPrice01IncTaxMax %}
<span class="ec-productRole__priceRegularPrice">{{ '通常価格'|trans }}:<span class="price01-default">{{ Product.getPrice01IncTaxMin|number_format }}</span></span>
<span class="ec-productRole__priceRegularTax">{{ '円(税込)'|trans }}</span>
{% elseif Product.getPrice01Min is not null and Product.getPrice01Max is not null %}
<span class="ec-productRole__priceRegularPrice">{{ '通常価格'|trans }}:<span class="price01-default">{{ Product.getPrice01IncTaxMin|number_format }}~ {{ Product.getPrice01IncTaxMax|number_format }}</span></span>
<span class="ec-productRole__priceRegularTax">{{ '円(税込)'|trans }}</span>
{% endif %}
</div>
{% else %}
{% if Product.getPrice01Max is not null %}
<span class="ec-productRole__priceRegularPrice">{{ '通常価格'|trans }}:{{ Product.getPrice01IncTaxMin|number_format }}</span>
<span class="ec-productRole__priceRegularTax">{{ '円(税込)'|trans }}</span>
{% endif %}
{% endif %}
{# 販売価格 #}
<div class="ec-productRole__price">
{% if Product.hasProductClass -%}
{% if Product.getPrice02IncTaxMin == Product.getPrice02IncTaxMax %}
<div class="ec-price">
<span class="ec-price__price price02-default">{{ Product.getPrice02IncTaxMin|number_format }}</span>
<span class="ec-price__tax">{{ '円(税込)'|trans }}</span>
</div>
{% else %}
<div class="ec-price">
<span class="ec-price__price price02-default">{{ Product.getPrice02IncTaxMin|number_format }} ~ {{ Product.getPrice02IncTaxMax|number_format }}</span>
<span class="ec-price__tax">{{ '円(税込)'|trans }}</span>
</div>
{% endif %}
{% else %}
<div class="ec-price">
<span class="ec-price__price">{{ Product.getPrice02IncTaxMin|number_format }}</span>
<span class="ec-price__tax">{{ '円(税込)'|trans }}</span>
</div>
{% endif %}
</div>
{# ポイント #}
<div class="ec-productRole__point ec-productRole__code point-display-container" style="display:none">
<span class="product-point-default">{{ 'joolendisplaypoints4.front.point.label'|trans }}</span>
<span class="point-display"></span>
</div>
<div class="border__box">
{# 商品コード #}
{% if Product.code_min is not empty %}
<div class="ec-productRole__code">
{{ '商品コード'|trans }}: <span class="product-code-default">{{ Product.code_min }}{% if Product.code_min != Product.code_max %} ~ {{ Product.code_max }}{% endif %}</span>
</div>
{% endif %}
<form action="{{ url('product_add_cart', {id:Product.id}) }}" method="post" id="form1" name="form1" class="conversion_box">
{% 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>
<div class="ec-productRole__btn conversion_btn">
<div class="ec-numberInput select_amount"><span class="amount">{{ '数量'|trans }}</span>
{{ form_widget(form.quantity) }}
{{ form_errors(form.quantity) }}
</div>
<button type="submit" class="ec-blockBtn--action add-cart">
{{ 'カートに入れる'|trans }}
{# <span class="ec-icon"><img src="{{ asset('assets/icon/icon_cart_wh.svg') }}" alt="カートアイコン"/></span> #}
</button>
</div>
{% else %}
<div class="ec-productRole__btn conversion_btn">
<button type="button" class="ec-blockBtn--action" disabled="disabled">
{{ 'ただいま品切れ中です。'|trans }}
</button>
</div>
{% endif %}
{{ form_rest(form) }}
</form>
</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">{{ 'カートに追加しました。'|trans }}</div>
<div class="ec-modal-box">
<div class="ec-role">
<span class="ec-inlineBtn--cancel">{{ 'お買い物を続ける'|trans }}</span>
<a href="{{ url('cart') }}" class="ec-inlineBtn--action">{{ 'カートへ進む'|trans }}</a>
</div>
</div>
</div>
</div>
</div>
{% if BaseInfo.option_favorite_product %}
<form action="{{ url('product_add_favorite', {id:Product.id}) }}" method="post">
<div class="ec-productRole__btn">
{% if is_favorite == false %}
<button type="submit" id="favorite" class="ec-blockBtn--cancel btn_outline">
<span class="ec-icon"><img src="{{ asset('assets/icon/icon_heart_line.svg') }}" alt=""/></span>{{ 'お気に入りに追加'|trans }}
</button>
{% else %}
<button type="submit" id="favorite" class="ec-blockBtn--cancel"
disabled="disabled">{{ 'お気に入りに追加済です。'|trans }}
</button>
{% endif %}
</div>
</form>
{% endif %}
</div>
</div>
</div>
<div class="ec-productRole__description">
{{ Product.description_detail|raw|nl2br }}
</div>
{% if Product.freearea %}
<div class="ec-productRole__description">
{{ include(template_from_string(Product.freearea), sandboxed = true) }}
</div>
{% endif %}
{# 関連カテゴリ #}
{% if Product.ProductCategories is not empty %}
<div class="ec-productRole__category ec-productRole__description">
<h3><label>{{ '関連カテゴリ'|trans }}</label></h3>
{% 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 %}
</div>
{% include 'Block/guide.twig' %}
{% endblock %}