{#
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);
//工事特急券の場合、カートへ移動
if ($('.add-cart').hasClass('cart-express')) {
location.href = "{{ url('cart') }}";
}
});
});
});
$('.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": "{{ Product.name }}",
"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 | default(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 : 0}},
"availability": "{{ Product.stock_find ? "InStock" : "OutOfStock" }}"
}
}
</script>
<script>
$(function() {
setTimeout(function() {
$('.slider-for').slick({
slidesToShow: 1,
slidesToScroll: 1,
arrows: false,
fade: true,
asNavFor: '.slider-nav',
}).on('init', function(event, slick) {
console.log('slider-for đã khởi tạo');
});
$('.slider-nav').slick({
slidesToShow: $('.slider-nav img').length,
slidesToScroll: 0,
asNavFor: '.slider-for',
centerMode: true,
focusOnSelect: true
});
}, 300);
});
</script>
<script>
$(function() {
$('#favorite-heart').click(function(event) {
$('#favorite').click();
});
});
</script>
{% endblock %}
{% block main %}
{% if Product.id == 1207 %}
{# 工事特急券 #}
<div class="ec-featured-product-page">
<div class="ec-banner">
<div class="ec-banner__inner">
<div class="inner">
<h2>{{ Product.name }}</h2>
</div>
</div>
<div class="ec-breadcrumb">
<ul class="ec-breadcrumb__menu">
<li class="ec-breadcrumb__item"><a href="{{ url('homepage') }}">TOP</a></li>
<li class="ec-breadcrumb__item"><span>></span></li>
<li class="ec-breadcrumb__item"><p>{{ Product.name }}</p></li>
</ul>
</div>
</div>
</div>
<div class="ec-product-detail-page">
<div class="ec-inquiry-page">
<div class="ec-product-detail-main">
<div class="ec-product-detail__inner">
<div class="inner">
<div class="product-press">
<table>
<tr>
<th width="25%">工事種別</th>
<th width="25%">期間</th>
<th width="25%">追加料金</th>
<th width="25%">備考</th>
</tr>
<tr>
<td>特急工事</td>
<td>1週間以内 </td>
<td>{{ Product.getPrice02Min| number_format(0, ",") }}円(税抜) </td>
<td>万が一期間内に実施できなかった場合は、全額返金保証有</td>
</tr>
<tr>
<td>通常工事</td>
<td>1週間~1ヶ月<br><small>※繁忙期等の混雑状況によります。</small></td>
<td>標準工事費に含む</td>
<td></td>
</tr>
</table>
<p>通常工事は、ご注文をいただいた順にご案内をさせていただきます。お客様の注文状況や工事エリア、繁忙期等により異なりますが、工事特急券をご利用いただいた場合、1週間以内で設置工事が完了するように優先的に工事のご案内をさせていただきます。万が一、1週間以内に設置工事が完了しなかった場合は、工事特急券費用({{ Product.getPrice02Min| number_format(0, ",") }}円)は全額返金させていただきます。</p>
<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_row(form.classcategory_id1) }}
{{ form_errors(form.classcategory_id1) }}
</div>
{% if form.classcategory_id2 is defined %}
<div class="ec-select">
{{ form_row(form.classcategory_id2) }}
{{ form_errors(form.classcategory_id2) }}
</div>
{% endif %}
{% endif %}
<div class="ec-numberInput" style="display: none;">
{{ form_widget(form.quantity) }}
{{ form_errors(form.quantity) }}
</div>
</div>
<div class="ec-product-detail__group">
<div class="list-btn">
<a href="{{ url('cart') }}" class="btn btn-back"><span>戻る</span></a>
</div>
<div class="product">
<div class="right">
<div class="list-btn">
<button type="submit" class="cart add-cart cart-express" style="border: none;">
<span>{{ 'カートに入れる'|trans }}</span>
</button>
</div>
</div>
</div>
</div>
{% endif %}
{{ form_rest(form) }}
</form>
</div>
</div>
</div>
</div>
</div>
</div>
{% else %}
{% set isTelProduct = false %}
{% set isLoanProduct = false %}
{% if Product.ProductCategories is not empty %}
{% for ProductCategory in Product.ProductCategories %}
{% if ProductCategory.Category.id == 117 %}
{% set isTelProduct = true %}
{% endif %}
{% if (ProductCategory.category_id == 118) %}
{% set isLoanProduct = true %}
{% endif %}
{% endfor %}
{% endif %}
{# 普通商品 #}
<div class="ec-product-detail-page">
<div class="ec-inquiry-page">
<div class="ec-banner">
<div class="ec-breadcrumb">
<ul class="ec-breadcrumb__menu">
<li class="ec-breadcrumb__item"><a href="{{ url('homepage') }}">TOP</a></li>
<li class="ec-breadcrumb__item"><span>></span></li>
{% if Product.ProductCategories is not empty %}
{% for ProductCategory in Product.ProductCategories %}
{% if ProductCategory.Category.id == 7 or ProductCategory.Category.id == 8 %}
<li class="ec-breadcrumb__item"><a href="{{ url('product_list') }}?category_id={{ ProductCategory.Category.id }}">{{ ProductCategory.Category.name }}</a></li>
<li class="ec-breadcrumb__item"><span>></span></li>
{% endif %}
{% endfor %}
{% endif %}
<li class="ec-breadcrumb__item"><p>{{ Product.name }}</p></li>
</ul>
</div>
</div>
<div class="ec-product-detail-main">
<div class="ec-product-detail__inner">
<div class="inner">
<div class="ec-product-detail__group">
<div class="product tatami">
<div class="left">
<div class="slider-for">
{% for ProductImage in Product.ProductImage %}
<img src="{{ asset(ProductImage, 'save_image') }}" alt="{{ loop.first ? Product.name : '' }}">
{% else %}
<img src="{{ asset(''|no_image_product, 'save_image') }}" alt="{{ loop.first ? Product.name : '' }}">
{% endfor %}
</div>
<div class="slider-nav">
{% for ProductImage in Product.ProductImage %}
<img src="{{ asset(ProductImage, 'save_image') }}" alt="{{ loop.first ? Product.name : '' }}">
{% else %}
<img src="{{ asset(''|no_image_product, 'save_image') }}" alt="{{ loop.first ? Product.name : '' }}">
{% endfor %}
</div>
</div>
<div class="right">
{% for ProductCategory in Product.ProductCategories %}
{% if ProductCategory.Category.name == "おすすめ" %}
<div class="list-cate v2">
{% for cate in categories %}
{% if cate.parent == "機能" %}
{% if cate.id in recommendCatChild %}
<img src="{{ asset('assets/img/product/cate-') }}{{cate.id}}.png" alt=""/>
{% else %}
<img src="{{ asset('assets/img/product/cate-') }}{{cate.id}}-uc.png" alt=""/>
{% endif %}
{% endif %}
{% endfor %}
</div>
{% endif %}
{% endfor %}
{% if Product.ProductCategories is not empty %}
{% for ProductCategory in Product.ProductCategories %}
{% if ProductCategory.Category.name == "おすすめ" %}
<div class="list-cate v3">
<div class="year-model">
{% for cate in categories %}
{% if cate.parent == "20XXモデル" %}
{% if cate.id in moderYearCatChild %}
<img src="{{ asset('assets/img/product/ymodel-') }}{{cate.id}}.png" alt=""/>
{% endif %}
{% endif %}
{% endfor %}
</div>
{% for cate in categories %}
{% if cate.parent == "メーカー" %}
{% if cate.id in tradeCatChild %}
<img src="{{ asset('assets/img/product/trademark-') }}{{cate.id}}.png" alt=""/>
{% endif %}
{% endif %}
{% endfor %}
</div>
{% endif %}
{% endfor %}
{% endif %}
<div class="list-cate basic">
{% if Product.ProductCategories is not empty %}
{% for ProductCategory in Product.ProductCategories %}
{% if ProductCategory.Category.Parent is not empty %}
{% set parentCat = ProductCategory.Category.Parent %}
{% if parentCat.id == 20 and parentCat.id == 21 %}
{{ ProductCategory.Category.name }}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
</div>
<div class="title">
<p>{{ Product.name }}</p>
</div>
<div class="price">
{# 通常価格 #}
{# {% 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 %}
<p>
{# <span>¥</span> #}
{{ Product.getPrice02IncTaxMin|price }}
<small>(税込)</small>
</p>
{% else %}
<p>
{# <span>¥</span> #}
{{ Product.getPrice02IncTaxMin|price }} ~ {{ Product.getPrice02IncTaxMax|price }}
<small>(税込)</small>
</p>
{% endif %}
{% else %}
<p>
{% if recommendCatChild %}
{% if(isLoanProduct == true) %}
{% set priceProduct = ((Product.getPrice02IncTaxMin / 24 / 10) // 1 * 10) %}
<span class="price-1">月々<span class="ic-yen">¥</span>{{ priceProduct|number_format(0, ",") }}/24回払い</span><br />
<span>価格: </span>
<span class="price-2">¥</span>
<span class="price-2">{{ Product.getPrice02IncTaxMin| number_format(0, ",") }}</span>
<small>(税込)</small>
<span class="price-2"> / ¥{{ Product.getPrice02Min| number_format(0, ",") }}</span>
<small>(税抜)</small>
{% else %}
<span>価格: </span>
<span class="ic-yen">¥</span>
<span class="price-1">{{ Product.getPrice02IncTaxMin| number_format(0, ",") }}</span>
<small>(税込)</small>
<span class="price-2"> / ¥{{ Product.getPrice02Min| number_format(0, ",") }}</span>
<small>(税抜)</small>
{% endif %}
{% else %}
{# <span>¥</span> #}
{{ Product.getPrice02IncTaxMin|price }}
<small>(税込)</small>
{% endif %}
</p>
{% endif %}
</div>
</div>
{% if Product.code_min is not empty %}
<div class="num-product">
<p>品番</p>
<span>{{ Product.code_min }}{% if Product.code_min != Product.code_max %} ~ {{ Product.code_max }}{% endif %}</span>
</div>
{% endif %}
{# <div class="func">
<p>機能</p>
<span>{{ Product.Feature.name }}</span>
</div> #}
<div class="text">
<p>{{ Product.description_detail|raw|nl2br }}</p>
</div>
<form action="{{ url('product_add_cart', {id:Product.id}) }}" method="post" id="form1" name="form1">
{{ form_widget(form._token) }}
{{ form_widget(form.product_id) }}
{{ form_widget(form.ProductClass) }}
{% if Product.stock_find %}
<div class="ec-productRole__actions">
{% if form.classcategory_id1 is defined %}
<div class="ec-select">
{{ form_row(form.classcategory_id1) }}
{{ form_errors(form.classcategory_id1) }}
</div>
{% if form.classcategory_id2 is defined %}
<div class="ec-select">
{{ form_row(form.classcategory_id2) }}
{{ form_errors(form.classcategory_id2) }}
</div>
{% endif %}
{% endif %}
{% if isTelProduct != true %}
<div class="ec-numberInput"><span>{{ '数量'|trans }}</span>
{{ form_widget(form.quantity) }}
{{ form_errors(form.quantity) }}
</div>
{% endif %}
</div>
<div class="list-btn">
{% if isTelProduct == true %}
<a href="tel:080-0222-4466" class="cart cart-tel" style="border: none;">
<span>{{ '080-0222-4466'|trans }}</span>
</a>
{% elseif isLoanProduct == true %}
<a href="{{ url('loan_examination') }}?id={{ Product.id }}" class="cart cart-loan" style="border: none;">
<span>{{ '審査のお申込み'|trans }}</span>
</a>
{% else %}
<button type="submit" class="cart add-cart" style="border: none;">
<span>{{ 'カートに入れる'|trans }}</span>
</button>
{% endif %}
{% if is_favorite == false %}
<a href="javascript:void(0);" id="favorite-heart" class="favorite"><span></span></a>
{% else %}
<a href="javascript:void(0);" class="favorite active"><span></span></a>
{% endif %}
</div>
{% else %}
<div class="list-btn">
<button type="button" class="cart" disabled="disabled">
{{ 'ただいま品切れ中です。'|trans }}
</button>
{% if is_favorite == false %}
<a href="javascript:void(0);" id="favorite-heart" class="favorite"><span></span></a>
{% else %}
<a href="javascript:void(0);" class="favorite active"><span></span></a>
{% endif %}
</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 %}
<div style="display: none;">
<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 }}
</button>
{% else %}
<button type="submit" id="favorite" class="ec-blockBtn--cancel"
disabled="disabled">{{ 'お気に入りに追加済です。'|trans }}
</button>
{% endif %}
</div>
</form>
</div>
{% endif %}
</div>
</div>
<div class="list-btn">
<a href="{{ url('homepage') }}#construction" class="btn btn-sd"><span>各種工事について</span></a>
<a href="{{ url('contact') }}" class="btn btn-sd"><span>お問い合わせ</span></a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endif %}
{% endblock %}