{#
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 detailWrap' %}
{% set breadcrumbs = {
'/products/list':'商品一覧',
'':Product.name
} %}
{% 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() {
$('.add-cart').on('click', function(event) {
var form_prefix = '.cartArea01 ';
if($(this).hasClass('fixBox01-add-cart')){
form_prefix = '.fixBox01 ';
}else if($(this).hasClass('lpCartBtn')){
form_prefix = '.lpCartArea01 '
}
{% if form.classcategory_id1 is defined %}
console.log('c1');
// 規格1フォームの必須チェック
if ($(form_prefix + '#classcategory_id1').val() == '__unselected' || $(form_prefix + '#classcategory_id1').val() == '') {
console.log('c2')
$(form_prefix + '#classcategory_id1')[0].setCustomValidity('{{ '項目が選択されていません'|trans }}');
return true;
} else {
$(form_prefix + '#classcategory_id1')[0].setCustomValidity('');
}
{% endif %}
console.log('bbb');
{% if form.classcategory_id2 is defined %}
// 規格2フォームの必須チェック
if ($(form_prefix + '#classcategory_id2').val() == '__unselected' || $(form_prefix + '#classcategory_id2').val() == '') {
$(form_prefix + '#classcategory_id2')[0].setCustomValidity('{{ '項目が選択されていません'|trans }}');
return true;
} else {
$(form_prefix + '#classcategory_id2')[0].setCustomValidity('');
}
{% endif %}
console.log('ccccc');
// 個数フォームのチェック
if ($(form_prefix + '#quantity').val() < 1) {
$(form_prefix + '#quantity')[0].setCustomValidity('{{ '1以上で入力してください。'|trans }}');
return true;
} else {
$(form_prefix + '#quantity')[0].setCustomValidity('');
}
console.log('ddddd');
event.preventDefault();
$form = $(form_prefix + '#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);
});
$('#ec-modal-checkbox').prop('checked', true);
// カートブロックを更新する
$.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);
});
});
});
</script>
{% endblock %}
{% block main %}
{% include 'Block/breadcrumbs.twig' %}
{% if Product.template_type is null %}
{% include 'Product/detail_default.twig' %}
{% else %}
{% include Product.template_type %}
{% endif %}
<!-- カート追加後のモーダル -->
<div class="ec-modal">
<input type="checkbox" id="ec-modal-checkbox" class="checkbox">
<div class="ec-modal-overlay">
<label for="ec-modal-checkbox" class="ec-modal-overlay-close"></label>
<div class="ec-modal-wrap">
<label for="ec-modal-checkbox" class="ec-modal-close"><span class="ec-icon"><img src="/html/user_data/dummy.jpg" class="lazy" data-src="/html/template/default/assets/icon/cross-dark.svg" alt=""/></span></label>
<div id="ec-modal-header" class="text-center">カートに追加しました。</div>
<div class="ec-modal-box">
<div class="ec-role">
<label for="ec-modal-checkbox" class="ec-inlineBtn--cancel">お買い物を続ける</label>
<a href="/cart" class="ec-inlineBtn--action">カートへ進む</a>
</div>
</div>
</div>
</div>
</div>
<!-- 下部固定カート追加ボタン -->
<div class="fixBox01">
<div class="flexWrap">
<form action="{{ url('product_add_cart', {id:Product.id}) }}" method="post" id="form1" name="form1">
{% if Product.cart_btn_type == "1" %}
<div class="telBox pc">
<span class="telTxt">
<img src="/html/user_data/dummy.jpg" class="lazy" data-src="/html/template/default/assets/img/common/ico_tel_pink.png" alt="">
{{ BaseInfo.getTelNumber }}
<span>[受付時間]平日 10:00~18:00</span>
</span>
</div>
<p class="sp txt">この商品ついて<span>申込み・問合せ</span>する</p>
<div class="btnBox spWidth01">
<a href="tel:{{ BaseInfo.TelNumber }}" class="btn02 sp tel lineBtn01"><img src="/html/user_data/dummy.jpg" class="lazy" data-src="/html/template/default/assets/img/common/ico_tel_pink.png" alt="">電話をかける</span><img src="/html/user_data/dummy.jpg" class="lazy" data-src="/html/user_data/assets/img/top/ico_bottom01.png" alt=""></a>
<a href="/contact" class="btn02 mailBtn01"><img src="/html/user_data/dummy.jpg" class="lazy" data-src="/html/user_data/assets/img/top/ico_mail01.png" alt="">メール<span class="pc">で<br>申込み・問合せする</span><img src="/html/user_data/dummy.jpg" class="lazy" data-src="/html/user_data/assets/img/top/ico_arrow_right01.png" alt=""></a>
</div>
{% else %}
<div class="priceWrap">
{% if Product.ProductClasses.0.SaleType.id == 3 %}
<p class="rentalPrice lowPrice">
<span class="priceTxt"> <span class="tag06">初月費用</span>{{ (Product.getPrice02IncTaxMin)|price }}<span class="label">税込</span></span><br>
<span class="priceTxt"> <span class="tag06 white">2ヶ月目以降</span>{{ (Product.ProductClasses.0.getSlnRegularPrice2 * 1.1)|price }}<span class="label">税込/月</span></span>
</p>
{% else %}
<p class="lowPrice">
{% if Product.hasProductClass -%}
{% if Product.getPrice01Min is not null and Product.getPrice01IncTaxMin == Product.getPrice01IncTaxMax %}
<span class="priceTxt">{{ (Product.getPrice01IncTaxMin)|price }} <span class="label">税込</span></span>
{% elseif Product.getPrice01Min is not null and Product.getPrice01Max is not null %}
<span class="priceTxt">{{ Product.getPrice01IncTaxMin|price }}~ {{ Product.getPrice01IncTaxMax|price }} <span class="label">税込</span></span>
{% elseif Product.getPrice02Min is not null and Product.getPrice02IncTaxMin == Product.getPrice02IncTaxMax %}
<span class="priceTxt">{{ (Product.getPrice02IncTaxMin)|price }} <span class="label">税込</span></span>
{% elseif Product.getPrice02Min is not null and Product.getPrice02Max is not null %}
<span class="priceTxt">{{ Product.getPrice02IncTaxMin|price }}~ {{ Product.getPrice02IncTaxMax|price }} <span class="label">税込</span></span>
{% endif %}
{% else %}
<span class="priceTxt">{{ Product.getPrice02IncTaxMin|price }} <span class="label">税込</span></span>
{% endif %}
{% endif %}
</p>
</div>
<div class="optionsWrap">
{% if Product.stock_find %}
<div class="ec-productRole__actions">
{% if form1.classcategory_id1 is defined %}
<div class="txt">
<img src="/html/user_data/dummy.jpg" class="lazy" data-src="/html/template/default/assets/img/common/item_select_icon.png" alt="">
</div>
<div class="classList">
<div class="ec-select {% if form1.classcategory_id2 is defined %}half{% endif %}">
<span>{{ Product.getClassName1 }}</span>
{{ form_widget(form1.classcategory_id1) }}
{{ form_errors(form1.classcategory_id1) }}
</div>
{% if form1.classcategory_id2 is defined %}
<div class="ec-select half">
<span>{{ Product.getClassName2 }}</span>
{{ form_widget(form1.classcategory_id2) }}
{{ form_errors(form1.classcategory_id2) }}
</div>
{% endif %}
</div>
{% endif %}
</div>
{% else %}
<div class="ec-productRole__btn">
<button type="button" class="ec-blockBtn--action" disabled="disabled">
{{ 'ただいま品切れ中です。'|trans }}
</button>
</div>
{% endif %}
</div>
<div class="cartWrap">
<div class="ec-numberInput">
<span>{{ '数量'|trans }}</span>
{{ form_widget(form1.quantity) }}
{{ form_errors(form1.quantity) }}
</div>
<div class="spTrigger sp {% if Product.hasProductClass == false -%}hide{% endif %}"><img src="/html/user_data/dummy.jpg" class="lazy" data-src="/html/user_data/assets/img/top/ico_arrow_right01.png" alt=""></div>
<div class="ec-productRole__btn">
<button type="submit" class="ec-blockBtn--action add-cart fixBox01-add-cart btn-primary btnType01 {% if Product.hasProductClass == false -%}btnTxtCenter{% endif %}">カートに追加</button>
</div>
{{ form_rest(form1) }}
</div>
{% endif %}
</form>
</div>
</div>
{% endblock %}