{#
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;
}
/*=========▽ Youtube表示のためのCSS ▽===============*/
.youtube{
position:relative;
padding-bottom: 56.25%;
padding-top: 25px;
height: 0;
}
.youtube iframe{
position:absolute;
top:0;
right:0;
width:100%;
height:100%;
}
/*========= △Youtube表示のためのCSS △===============*/
/*=========▽ プロ会員専用通知CSS▽===============*/
.custom_shop_desc{
position:relative;
top:0;
right:0;
width:40%;
margin:auto;
}
/*========= △プロ会員専用通知CSS△===============*/
/*=========▽ 折りたたむメニュー▽===============*/
details[open] summary ~ * {
animation: open 0.5s ease-in-out;
}
@keyframes open {
0% { height: 0; }
100% { height: 100%; }
}
details[open] p {
animation: grow 0.8s ease-in-out;
}
@keyframes grow {
0% { opacity: 0; }
100% { opacity: 1; }
}
details summary:after {
content: "+";
color: black;
position: absolute;
font-size: 1.75rem;
line-height: 0;
margin-top: 1.25rem;
right: 0;
font-weight: 200;
transform-origin: center 17%;
font-size: 2rem;
display:inline-block;
height:1rem;
transition: 800ms linear;
}
details[open] summary:after {
transform: rotate(945deg);
}
details summary::-webkit-details-marker {
display: none;
}
details summary {
width: 100%;
padding: 0.1rem 0;
border-top: 0.1px solid black;
position: relative;
cursor: pointer;
font-size: 1.75rem;
font-weight: 300;
list-style: none;
}
details summary {
outline: 0;
}
details p {
font-size: 1.5rem;
margin: 0 0 0rem;
padding-top: 0rem;
}
}
section {
padding-top: 1em;
width: 50%;
margin: auto;
}
.custom_jiasuan_jifen{
color:#c80be5 !important;
font-size: 1em;
padding-left: 0 !important;
display: inline-block;
padding: 0 0.3em;
font-weight: bold;
}
/*========= △折りたたむメニュー△===============*/
#payment-request-button{
display: none !important;
}
</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() {
// 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() {
// 获取所有具有 class="product-option-select" 的 select 标签
const selects = document.querySelectorAll('.product-option-select');
// 检查是否所有 select 标签都选择了选项
function areAllOptionsSelected() {
for (let select of selects) {
if (select.value === "") { // 检查是否有未选择的选项
return false;
}
}
return true;
}
// 绑定一个事件监听器,监控选项的变化
selects.forEach(select => {
select.addEventListener('change', function() {
if (areAllOptionsSelected()) {
console.log('所有选项都已选择');
} else {
console.log('还有选项未选择');
}
});
});
$('.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 (!areAllOptionsSelected()) {
alert('未選択の項目があります!');
return false;
}
// 個数フォームのチェック
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').html(this);
});
if ('{{user_login}}' == "N") {
var cartUrl = '{{ url('shopping_nonmember') }}';
window.location.href = cartUrl;
}
else{
$('.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>
{% 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>
{# 関連カテゴリ #}
{% 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 %}
</div>
{# 商品コード #}
{# {% 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 %} #}
{# 通常価格 #}
{% 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|price }}</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|price }}~ {{ Product.getPrice01IncTaxMax|price }}</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|price }}</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 style="font-size: 1em;font-weight: bold; color: #F74B57;line-height: 1.6;">販売価格:</span>
<span class="ec-price__price price02-default">{{ Product.getPrice02IncTaxMin|price }}</span>
<span class="ec-price__tax">{{ '税込'|trans }}</span>
</div>
{# 商户会员显示折扣价格 #}
{% if is_shop %}
{% if Product.getShopDiscount =='Y' %}
{% set discount_price = (100-discount)/100 * Product.getPrice02IncTaxMin %}
<div class="ec-price">
<span class="ec-price__price price02-default">割引価格:{{ discount_price|price }}</span>
<span class="ec-price__tax">{{ '税込'|trans }}</span>
</div>
{% else %}{# 非折扣商品显示'プロ会員値引き対象外商品'#}
<div class="ec-price">
<span class="ec-price__price price02-default">プロ会員値引き対象外商品</span>
</div>
{% endif %}
{% elseif points_rate != 0 %}{# 非商户会员情况下,显示积分 #}
{% set points = (points_rate/100) * Product.getPrice02Min %}
<div class="ec-price">
<span class="custom_jiasuan_jifen">加算ポイント:{{ points|round(0,'common')|number_format }}pt</span>
</div>
{% endif %}
{% else %}
<div class="ec-price">
<span style="font-size: 1em;font-weight: bold; color: #F74B57;line-height: 1.6;">販売価格:</span>
<span class="ec-price__price price02-default">{{ Product.getPrice02IncTaxMin|price }} ~ {{ Product.getPrice02IncTaxMax|price }}</span>
<span class="ec-price__tax">{{ '税込'|trans }}</span>
</div>
{# 商户会员显示折扣价格 #}
{% if is_shop %}
{% if Product.getShopDiscount =='Y' %}
{% set discount_price1 = (100-discount)/100 * Product.getPrice02IncTaxMin %}
{% set discount_price2 = (100-discount)/100 * Product.getPrice02IncTaxMax %}
<div class="ec-price">
<span class="ec-price__price price02-default">割引価格:{{ discount_price1|price }} ~ {{ discount_price1|price }}</span>
<span class="ec-price__tax">{{ '税込'|trans }}</span>
</div>
{% else %}{# 非折扣商品显示'プロ会員値引き対象外商品'#}
<div class="ec-price">
<span class="ec-price__price price02-default">プロ会員値引き対象外商品</span>
</div>
{% endif %}
{% elseif points_rate != 0 %} {# 非商户会员情况下,显示积分 #}
{% set points1 = (points_rate/100) * Product.getPrice02Min %}
{% set points2 = (points_rate/100) * Product.getPrice02Max %}
<div class="ec-price">
<span class="custom_jiasuan_jifen">加算ポイント:{{ points1|round(0,'common')|number_format }} ~ {{ points2|round(0,'common')|number_format }}pt</span>
</div>
{% endif %}
{% endif %}
{% else %}
<div class="ec-price">
<span style="font-size: 1em;font-weight: bold; color: #F74B57;line-height: 1.6;">販売価格:</span>
<span class="ec-price__price">{{ Product.getPrice02IncTaxMin|price }}{{ '税込'|trans }}</span>
<span class="ec-price__tax"></span>
</div>
{# 商户会员显示折扣价格 #}
{% if is_shop %}
{% if Product.getShopDiscount =='Y' %}
{% set discount_price = (100-discount)/100 * Product.getPrice02IncTaxMin %}
<div class="ec-price">
<span class="ec-price__price price02-default">割引価格:{{ discount_price|price }}</span>
<span class="ec-price__tax">{{ '税込'|trans }}</span>
</div>
{% else %}{# 非折扣商品显示'プロ会員値引き対象外商品'#}
<div class="ec-price">
<span class="ec-price__price price02-default">プロ会員値引き対象外商品</span>
</div>
{% endif %}
{% elseif points_rate != 0 %}{# 非商户会员情况下,显示积分 #}
{% set points = (points_rate/100) * Product.getPrice02Min %}
<div class="ec-price">
<span class="custom_jiasuan_jifen">加算ポイント:{{ points|round(0,'common')|number_format }}pt</span>
</div>
{% endif %}
{% endif %}
</div>
<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_label(form.classcategory_id1) }}
{{ form_widget(form.classcategory_id1) }}
{{ form_errors(form.classcategory_id1) }}
</div>
{% if form.classcategory_id2 is defined %}
<div class="ec-select">
{{ form_label(form.classcategory_id2) }}
{{ form_widget(form.classcategory_id2) }}
{{ form_errors(form.classcategory_id2) }}
</div>
{% endif %}
{% endif %}
<div class="ec-numberInput"><span>{{ '数量'|trans }}</span>
{{ form_widget(form.quantity) }}
{{ form_errors(form.quantity) }}
</div>
</div>
<div class="ec-productRole__btn custom_add_cart">
<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">
<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">
{{ 'お気に入りに追加'|trans }}
{% if favorite_count %}
<span class="favorite-count" data-prefix="件">{{ favorite_count }}件</span>
{% endif %}
</button>
{% else %}
<button type="submit" id="favorite" class="ec-blockBtn--cancel"
disabled="disabled">{{ 'お気に入りに追加済です。'|trans }}
</button>
{% endif %}
</div>
</form>
{% endif %}
{% if is_shop == false %}
<div class="ec-productRole__description">{{ Product.description_detail|raw|nl2br }}</div>
{% else %}
<div class="ec-productRole__description custom_shop_detail">{{ Product.description_detail|raw|nl2br }}</div>
{% endif %}
{% if Product.freearea %}
{% if is_shop == false %}
<!-- <div class="ec-productRole__description">{{ include(template_from_string(Product.freearea)) }}</div> -->
<div class="ec-productRole__description">{{ Product.freearea|raw|nl2br }}</div>
{% else %}
<!-- <div class="ec-productRole__description custom_shop_detail">{{ include(template_from_string(Product.freearea)) }}</div> -->
<div class="ec-productRole__description custom_shop_detail">{{ Product.freearea|raw|nl2br }}</div>
{% endif %}
{% endif %}
</div>
</div>
</div>
</div>
{% endblock %}