{#
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-single-page' %}
{% block javascript %}
<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('{{ 'front.product.product_class_unselected'|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('{{ 'front.product.product_class_unselected'|trans }}');
return true;
} else {
$('#classcategory_id2')[0].setCustomValidity('');
}
{% endif %}
// 個数フォームのチェック
if ($('#quantity').val() < 1) {
$('#quantity')[0].setCustomValidity('{{ 'front.product.invalid_quantity'|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('{{ 'front.product.add_cart_error'|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()
});
// form_restで出力されるquantityを削除
$(() => {
$('#quantity').remove();
})
</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>
{% endblock %}
{% block main %}
<div class="product-single">
<h1 class="product-single__head inview">PRODUCT</h1>
<div class="product-single__main-row inview">
<div class="product-single__main-thumb img-slider">
<div class="arrow arrow-left"></div>
<div class="arrow arrow-right"></div>
<ul class="index__list">
{% for ProductImage in Product.ProductImage %}
<li class="index__item"></li>
{% endfor %}
</ul>
<div class="img-wrap">
{% for ProductImage in Product.ProductImage %}
<img src="{{ asset(ProductImage, 'save_image') }}" alt="{{ loop.first ? Product.name : '' }}" width="550" height="550"{% if loop.index > 1 %} loading="lazy"{% endif %}>
{% else %}
<img src="{{ asset(''|no_image_product, 'save_image') }}" alt="{{ loop.first ? Product.name : '' }}" width="550" height="550">
{% endfor %}
</div>
</div>
<div class="product-single__main-col">
<h2 class="product-single__main-title">{{ Product.name }}</h2>
<p class="product-single__main-price">
{% if Product.subscription_discount_rate is defined and Product.subscription_discount_rate > 0 %}
{% set discount_rate = Product.subscription_discount_rate %}
{% set original_price = Product.getPrice02IncTaxMin %}
{% set discounted_price = (original_price * (100 - discount_rate) / 100)|round(0, 'floor') %}
<span style="color: red; font-weight: bold; margin-right: 10px;">-{{ discount_rate }}%</span>
<span style="color: var(--color-black);">{{ discounted_price|price }}(税込)</span>
<br>
<span style="font-size: 0.9em; color: #999;">参考価格:
<span style="text-decoration: line-through; color: #999;">{{ original_price|price }}</span>
<br>
<span>※送料{{ fee|price }}円~</span>
</span>
{% else %}
{{ Product.getPrice02IncTaxMin|price }}(税込)<span>
<br>
※送料{{ fee|price }}円~(沖縄離島除く国内)</span>
{% endif %}
</p>
{% if Product.subscription %}
<p class="product-single__main-terms">
<a href="/subscription_terms">定期購入ご利用規約</a>
</p>
{% endif %}
<div class="product-single__count">
<form action="{{ url('product_add_cart', {id:Product.id}) }}" method="post" id="form1" name="form1" class="product-single___count-form">
{% if Product.stock_find %}
<div class="product-single__count-wrap">
<label class="product-single__count-label">数量</label>
<div class="product-single__count-select">
<select id="customQuantity" name="quantity" required="required">
{% for i in 1..(Product.getProductClasses()|length == 1 ? Product.getProductClasses()[0].saleLimit : 7) %}
<option value="{{ i }}">{{ i }}</option>
{% endfor %}
</select>
{{ form_errors(form.quantity) }}
</div>
</div>
<button class="product-single__count-btn btn -cart">
予約購入
</button>
<p style="color: red; padding: 5px 0; font-size: 12px;text-align: center;">※ こちらの商品は2月上旬にお届け予定です。</p>
{% else %}
<button class="product-single__count-btn btn" disabled="disabled">
在庫切れ
</button>
{% endif %}
<div style="display:none">
{{ form_rest(form) }}
</div>
</form>
</div>
</div>
</div>
<div class="product-single__content inview">
<div class="container product-single__container">
<section class="product-single__section">
<h3 class="product-single__section-title">製品概要</h3>
<div class="product-single__section-text">
<p>
{{ Product.description_list | default(Product.description_detail) }}
</p>
</div>
</section>
<section class="product-single__section">
<h3 class="product-single__section-title">原材料</h3>
<div class="product-single__section-text">
<p>米ぬか加工食品乳酸菌酵母含有米ぬか発酵物、デキストリン、ビタミンB12、ミルクシスル、HMPC(カプセル)</p>
</div>
</section>
<section class="product-single__section">
<h3 class="product-single__section-title">成分</h3>
<div class="product-single__section-text">
<p>1食分:2カプセル<br />
<table>
<tr>
<th></th>
<th>1食分の量</th>
</tr>
<tbody>
<tr>
<td>エネルギー</td>
<td>2.8kcal</td>
</tr>
<tr>
<td>たんぱく質</td>
<td>0.1g</td>
</tr>
<tr>
<td>脂質</td>
<td>0.02g</td>
</tr>
<tr>
<td>炭水化物</td>
<td>0.5g</td>
</tr>
</tbody>
</table>
<p>
<span>警告:18歳未満のお子様、妊娠中または授乳中の女性には適していません。<br />薬を服用されている方、持病のある方は、かかりつけ医や専門医にご相談されることをお勧めしま
す。</span
>
</p>
</div>
</section>
<section class="product-single__section">
<h3 class="product-single__section-title">配送について</h3>
<div class="product-single__section-text">
<p>
ご注文から6日以内にお届け致します。(土日祝日を除く)<br />
ただし2026年1月中においては商品切替時期のため、2月上旬以降に順次発送いたします。
</p>
</div>
</section>
</div>
</div>
</div>
{% endblock %}