{#
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 }};
// 規格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);
}
});
// Core Web Vital の Cumulative Layout Shift(CLS)対策のため
// img タグに width, height が付与されている.
// 630px 未満の画面サイズでは縦横比が壊れるための対策
// see https://github.com/EC-CUBE/ec-cube/pull/5023
$('.ec-grid2__cell').hide();
var removeSize = function () {
$('.slide-item').height('');
$('.slide-item img')
.removeAttr('width')
.removeAttr('height')
.removeAttr('style');
};
var slickInitial = function(slick) {
$('.ec-grid2__cell').fadeIn(1500);
var baseHeight = $(slick.target).height();
var baseWidth = $(slick.target).width();
var rate = baseWidth / baseHeight;
$('.slide-item').height(baseHeight * rate); // 余白を削除する
// transform を使用することでCLSの影響を受けないようにする
$('.slide-item img')
.css(
{
'transform-origin': 'top left',
'transform': 'scaleY(' + rate + ')',
'transition': 'transform .1s'
}
);
// 正しいサイズに近くなったら属性を解除する
setTimeout(removeSize, 500);
};
$('.item_visual').on('init', slickInitial);
// リサイズ時は CLS の影響を受けないため属性を解除する
$(window).resize(removeSize);
$('.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 %}
// 個数フォームのチェック
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-wrap').on('click', function(e) {
// モーダル内の処理は外側にバブリングさせない
e.stopPropagation();
});
$('.ec-modal-overlay, .ec-modal, .ec-modal-close, .ec-inlineBtn--cancel').on('click', function() {
$('.ec-modal').hide()
});
</script>
<script type="application/ld+json">
{
"@context": "https://schema.org/",
"@type": "Product",
"name": "{% if Product.Maker %}{{ Product.Maker.nameEn }} {% endif %}{{ Product.name }}{% if Product.model_year %} {{ Product.model_year }}{{ '年モデル'|trans }}{% endif %}",
"image": [
{% for img in Product.ProductImage %}
"{{ app.request.schemeAndHttpHost }}{{ asset(img, 'save_image') }}"{% if not loop.last %},{% endif %}
{% else %}
"{{ app.request.schemeAndHttpHost }}{{ asset(''|no_image_product, 'save_image') }}"
{% endfor %}
],
"description": "{{ (Product.description_list ~ ' ' ~ Product.description_detail) | replace({'\n': '', '\r': ''}) | slice(0,300) }}",
{% if Product.code_min %}
"sku": "{{ Product.code_min }}",
{% endif %}
"offers": {
"@type": "Offer",
"url": "{{ url('product_detail', {'id': Product.id}) }}",
"priceCurrency": "{{ eccube_config.currency }}",
"price": {{ Product.getPrice02IncTaxMin ? (Product.getPrice02IncTaxMin / 1.05)|round(0, 'common') : 0}},
"availability": "{{ Product.stock_find ? "InStock" : "OutOfStock" }}"
}
}
</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">
{% set ImageLoop = '' %}
{% for ProductImage in Product.ProductImage %}
{% set ImageLoop = loop.index %}
<div class="slide-item">
<img src="{{ asset(ProductImage, 'save_image') }}" alt="{% if loop.first %}{{ Product.Maker ? Product.Maker.nameEn ~ ' ' : '' }}{{ Product.name }}{% if Product.model_year %} {{ Product.model_year }}{{ '年モデル'|trans }}{% endif %}{% endif %}" width="550" height="550"{% if loop.index > 1 %} loading="lazy"{% endif %}>
{% if Product.ProductImageAlts is defined and Product.ProductImageAlts is not null %}
{% set altText = '' %}
{% set ProductImageAlt = Product.ProductImageAlts|filter(alt => alt.sort_no == ImageLoop)|first %}
{% if ProductImageAlt.alt_text is defined and ProductImageAlt.alt_text is not null %}
{% set altText = ProductImageAlt.alt_text %}
<p class="text-center" style="width:80%; margin-top:1em;">{{ altText }}</p>
{% endif %}
{% endif %}
</div>
{% else %}
<div class="slide-item"><img src="{{ asset(''|no_image_product, 'save_image') }}" alt="{% if loop.first %}{{ Product.Maker ? Product.Maker.nameEn ~ ' ' : '' }}{{ Product.name }}{% if Product.model_year %} {{ Product.model_year }}{{ '年モデル'|trans }}{% endif %}{% endif %}" width="550" height="550"></div>
{% endfor %}
</div>
<div class="item_nav">
{% set ImageLoop = '' %}
{% for ProductImage in Product.ProductImage %}
{% set ImageLoop = loop.index %}
<div class="slideThumb" data-index="{{ loop.index0 }}">
<img src="{{ asset(ProductImage, 'save_image') }}" alt="{{ Product.Maker ? Product.Maker.nameEn ~ ' ' : '' }}{{ Product.name }}{% if Product.model_year %} {{ Product.model_year }}{{ '年モデル'|trans }}{% endif %}" width="133" height="133" loading="lazy">
{% if Product.ProductImageAlts is defined and Product.ProductImageAlts is not null %}
{% set altText = '' %}
{% set ProductImageAlt = Product.ProductImageAlts|filter(alt => alt.sort_no == ImageLoop)|first %}
{% if ProductImageAlt.alt_text is defined and ProductImageAlt.alt_text is not null %}
{% set altText = ProductImageAlt.alt_text %}
<p class="text-center" style="width:80%;">{{ altText }}</p>
{% endif %}
{% endif %}
</div>
{% endfor %}
</div>
</div>
</div>
<div class="ec-grid2__cell">
<div class="ec-productRole__profile">
{# 商品名 #}
<div class="ec-productRole__title">
<h2 class="ec-headingTitle">{% if Product.Maker %}<span class="small"> {{ Product.Maker.nameEn }}({{ Product.Maker.nameJp }})</span>{% endif %}<br />{{ Product.name }}{% if Product.model_year %} {{ Product.model_year }}{{ '年モデル'|trans }}{% endif %}</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.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 %}
{# 販売価格、その他備考 #}
{# 表示について、規格1の選択肢がapp/Customize/Entity/ProductTrait.php、規格2の選択肢はeccube.jsで制御。 #}
{# 規格を持たない商品はこのファイル上で制御しているよう。 #}
{# 表示フラグ系はProductTypeExtension.phpで実装、ask_priceのみカートに値を渡して、値引処理に使用している。 #}
<div class="ec-productRole__price">
{% if Product.hasProductClass -%}
{# 規格を持つ商品の場合の処理 #}
{% if 'teika_price' in Product.ask_price and 'hidden_price' not in Product.ask_price %}
{# 現金特価未適用フラグがある場合、現金特価計算をさせないように動作。規格1規格2がある場合の動作修正はeccube.jsも触る。 #}
{% if Product.getPrice02IncTaxMin == Product.getPrice02IncTaxMax %}
<div class="ec-price">
<span class="ec-price__price">販売価格:</span>
<span class="ec-price__price price02-default teika_price">{{ Product.getPrice02IncTaxMin|price }}</span>
<span class="ec-price__tax">{{ '税込'|trans }}</span>
</div>
{% else %}
<div class="ec-price">
<span class="ec-price__price">販売価格:</span>
<span class="ec-price__price price02-default teika_price">{{ Product.getPrice02IncTaxMin|price }} ~ {{ Product.getPrice02IncTaxMax|price }}</span>
<span class="ec-price__tax">{{ '税込'|trans }}</span>
</div>
{% endif %}
{% elseif 'hidden_price' in Product.ask_price %}
{# 売価非表示フラグがある場合の処理。コメントありとなしで条件分岐。 #}
{% if Product.info_comment2 is not empty %}
<div class="ec-price">
<span class="ec-price__price">{{ Product.info_comment2|trans }}</span>
</div>
{% elseif Product.info_comment2 is empty %}
<div class="ec-price">
<span class="ec-price__price">{{ 'ビックリ大特価!'|trans }}</span>
</div>
{% endif %}
{% else %}
{# 条件なしの処理。現金特価での表示。規格2がある場合の動作修正はeccube.jsも同時に触る必要がある。 #}
{% if Product.getPrice02IncTaxMin == Product.getPrice02IncTaxMax %}
<div class="ec-price">
<span class="ec-price__price">現金特価:</span>
<span class="ec-price__price price02-default genkin_tokka">{{ (Product.getPrice02IncTaxMin / 1.05)|price }}</span>
<span class="ec-price__tax">{{ '税込'|trans }}</span>
</div>
{% else %}
<div class="ec-price">
<span class="ec-price__price">現金特価:</span>
<span class="ec-price__price price02-default genkin_tokka">{{ (Product.getPrice02IncTaxMin / 1.05)|price }} ~ {{ (Product.getPrice02IncTaxMax / 1.05)|price }}</span>
<span class="ec-price__tax">{{ '税込'|trans }}</span>
</div>
{% endif %}
{% endif %}
{% else %}
{# 規格がない商品の場合の処理 #}
{% if 'teika_price' in Product.ask_price and 'hidden_price' not in Product.ask_price %}
<div class="ec-price">
<span class="ec-price__price">販売価格:</span>
<span class="ec-price__price">{{ Product.getPrice02IncTaxMin|price }}</span>
<span class="ec-price__tax">{{ '税込'|trans }}</span>
</div>
{% elseif 'hidden_price' in Product.ask_price and Product.info_comment2 is not empty %}
<div class="ec-price">
<span class="ec-price__price">{{ Product.info_comment2|trans }}</span>
</div>
{% elseif 'hidden_price' in Product.ask_price and Product.info_comment2 is empty %}
<div class="ec-price">
<span class="ec-price__price">{{ 'ビックリ大特価!'|trans }}</span>
</div>
{% else %}
<div class="ec-price">
<span class="ec-price__price">現金特価:</span>
<span class="ec-price__price">{{ (Product.getPrice02IncTaxMin / 1.05)|price }}</span>
<span class="ec-price__tax">{{ '税込'|trans }}</span>
</div>
{% endif %}
{% 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.ProductCategories is not empty %}
<div class="ec-productRole__category">
<div>{{ '関連カテゴリ'|trans }}</div>
{% for ProductCategory in Product.ProductCategories %}
{% if ProductCategory.Category.countBranches == 1 %}
<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>
{% endif %}
{% 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_theme form.classcategory_id1 'Form/custom_form_div_layout.twig' %}
{{ form_row(form.classcategory_id1) }}
{{ form_errors(form.classcategory_id1) }}
</div>
{% if form.classcategory_id2 is defined %}
<div class="ec-select">
{% form_theme form.classcategory_id2 'Form/custom_form_div_layout.twig' %}
{{ form_row(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>
{% if Product.disable_cart is not empty %}
<div class="ec-productRole__btn">
<button type="button" class="ec-blockBtn--action" disabled="disabled">
{{ '対面販売の為、お問い合わせください。'|trans }}
</button>
</div>
{% elseif Product.disable_cart is empty %}
<div class="ec-productRole__btn">
<button type="submit" class="ec-blockBtn--action add-cart">
{{ 'カートに入れる'|trans }}
</button>
</div>
{% endif %}
{% else %}
{% if Product.disable_cart is not empty %}
<div class="ec-productRole__btn">
<button type="button" class="ec-blockBtn--action" disabled="disabled">
{{ '対面販売の為、お問い合わせください。'|trans }}
</button>
</div>
{% elseif Product.disable_cart is empty %}
<div class="ec-productRole__btn">
<button type="button" class="ec-blockBtn--action" disabled="disabled">
{{ 'ただいま品切れ中です。'|trans }}
</button>
</div>
{% endif %}
{% 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>
<div class="ec-productRole__btn">
<button onclick="location.href='{{ url('contact',{'contact_pname':contact_pname, 'contact_pcode':contact_pcode, 'contact_pid':contact_pid, })}}'" id="favorite" class="ec-blockBtn--cancel">
{{ 'お問い合わせ'|trans }}
</button>
</div>
<!--{% if BaseInfo.option_favorite_product %}
<form action="{{ url('contact') }}" method="post">
<div class="ec-productRole__btn">
{% if is_favorite == false %}
<button type="submit" id="favorite" class="ec-blockBtn--cancel">
{{ 'お問い合わせ'|trans }}
</button>
{% else %}
<button type="submit" id="favorite" class="ec-blockBtn--cancel"
disabled="disabled">{{ 'お気に入りに追加済です。'|trans }}
</button>
{% endif %}
</div>
</form>
{% endif %}-->
{# 以下商品の属性ごとの注意書きを表記する。 #}
<div>
<ul>
{% if Product.stock_find %} {# 在庫数が1以上のSKUが含まれている場合 #}
<li><span class="ec-color-red">在庫有り表示でも店頭展示していない場合があります。<span class="ec-font-bold">実物をご覧になりたい場合はご来店前にメールにてご連絡ください。</span></span></li>
{% endif %}
{% if Product.Tags|filter(tag => tag.id == 10)|length > 0 %} {# 商品タグにメーカー取寄せが含まれる場合 #}
<li>メーカー取寄せとなります。在庫状況はできる限り反映しておりますが、タイミングによっては欠品の場合もございます。</li>
{% endif %}
{% if 'f2f' in Product.delivery_product_type %} {# 商品の配送属性にf2f(対面販売)が含まれる場合 #}
<li>こちらの商品は原則<span class="ec-font-bold">対面販売</span>となります。ご購入の際は店頭かメールにてご相談ください。</li>
{% endif %}
{% if 'ebike' in Product.delivery_product_type %} {# 商品の配送属性にebikeが含まれる場合 #}
<li>大型商品となります。<span class="ec-font-bold">配送をご希望の場合は送料にご注意ください。</span>当店より30km圏内であれば、弊社スタッフが配送に伺いますので送料無料です。詳しくは店頭にてご相談ください。</li>
{% endif %}
{% if Product.Tags|filter(tag => tag.id == 8)|length > 0 %} {# 商品タグにアウトレット品が含まれる場合 #}
<li><span class="ec-font-bold">アウトレット品となります。</span>キズや塗装不良がある場合や、通常商品と保証内容が異なる場合があります。詳しくは店頭かメールにてご相談ください。</li>
{% endif %}
{% if Product.Tags|filter(tag => tag.id == 7)|length > 0 %} {# 商品タグに代理店取り寄せ特価が含まれる場合 #}
<li>代理店取り寄せの特価品です。当店で在庫はしていない場合は実物をご覧いただけません。</li>
{% endif %}
</ul>
</div>
</div>
</div>
</div>
{% if Product.description_detail %}
<div class="ec-productRole__description">{{ Product.description_detail|raw|nl2br }}
</div>
{% endif %}
{% if Product.freearea %}
<div class="ec-productRole__description">
{{ include(template_from_string(Product.freearea)) }}
</div>
{% endif %}
</div>
{% endblock %}