{#
商品詳細ページ用フローティングカートナビ
#}
{% block javascript %}
<script type="text/javascript">
$(function() {
// $('.product-detail-floating-nav').hide();
var targetClass = '.product-detail-floating-nav';
if (window.innerWidth > 767) { // PC表示の時のみに適用
targetClass += '.desktop';
}
else {
targetClass += '.mobile';
}
var $targetElem = $(targetClass);
$(window).on('scroll', function() {
if ($(this).scrollTop() > 500) {
$targetElem.slideDown();
} else {
$targetElem.slideUp();
}
return false;
});
// カートフォームのClone
$("#form1").clone().appendTo("#floating-nav-cart");
// フォーム要素のID修正
$formFloating = $("#floating-nav-cart");
$formFloating.find('form').prop('id', 'form2');
$formFloating.find('#classcategory_id1').prop('id', 'classcategory_id1-a');
$formFloating.find('#classcategory_id2').prop('id', 'classcategory_id2-a');
$formFloating.find('#quantity').prop('id', 'quantity-a');
});
</script>
{% endblock %}
{% if Product is defined and Product is not empty %}
<nav class="product-detail-floating-nav desktop">
<div class="ec-productRole__title">
<h2 class="ec-headingTitle">{{ Product.name }}</h2>
</div>
{# 販売価格 #}
<div class="ec-productRole__price">
{% if Product.hasProductClass -%}
{% if Product.getPrice02IncTaxMin == Product.getPrice02IncTaxMax %}
<div class="ec-price">
<span class="ec-price__price price02-default">{{ Product.getPrice02IncTaxMin|price }}</span>
<span class="ec-price__tax">{{ '税込'|trans }}</span>
</div>
{% else %}
<div class="ec-price">
<span class="ec-price__price price02-default">{{ Product.getPrice02IncTaxMin|price }} <small>~</small> {{ Product.getPrice02IncTaxMax|price }}</span>
<span class="ec-price__tax">{{ '税込'|trans }}</span>
</div>
{% endif %}
{% else %}
<div class="ec-price">
<span class="ec-price__price">{{ Product.getPrice02IncTaxMin|price }}</span>
<span class="ec-price__tax">{{ '税込'|trans }}</span>
</div>
{% endif %}
</div>
<div class="ec-productRole__btn">
{% if Product.stock_find %}
<a class="ec-blockBtn--action" data-toggle="modal" data-target="#cartModal">
<i class="fas fa-plus-circle"></i> {{ 'カートに入れる'|trans }}
</a>
{% else %}
<button type="button" class="ec-blockBtn--action" disabled="disabled">
<i class="fas fa-exclamation-triangle"></i> {{ 'ただいま品切れ中です。'|trans }}
</button>
{% endif %}
</div>
{% if BaseInfo.option_favorite_product %}
<form action="{{ url('product_add_favorite', {id:Product.id}) }}" method="post">
<div class="ec-productRole__btn mt-2">
{% if is_favorite == false %}
<button type="submit" id="favorite" class="ec-blockBtn--cancel">
<i class="fas fa-heart fa-fw"></i> お気に入りに追加
</button>
{% else %}
<button type="submit" id="favorite" class="ec-blockBtn--cancel" disabled="disabled">
<i class="fas fa-heart fa-fw"></i> お気に入り追加済
</button>
{% endif %}
</div>
</form>
{% endif %}
<div class="ec-productRole__btn mt-2 text-center">
<a href="{{ url('product_contact') }}?product_id={{ Product.id }}" class="btn d-block">商品について問い合せる</a>
</div>
</nav>
<nav class="product-detail-floating-nav mobile">
<div class="row">
<div class="col-5">
{% if Product.stock_find %}
<a class="cart d-block" data-toggle="modal" data-target="#cartModal">
<i class="fas fa-plus-circle"></i> {{ 'カートに入れる'|trans }}
</a>
{% else %}
<button type="button" class="cart" disabled="disabled">
<i class="fas fa-exclamation-triangle"></i> {{ '品切れ中'|trans }}
</button>
{% endif %}
</div>
<div class="col-4">
{% if BaseInfo.option_favorite_product %}
<form action="{{ url('product_add_favorite', {id:Product.id}) }}" method="post">
{% if is_favorite == false %}
<button type="submit" id="favorite" class="d-block text-center full-width">
<i class="fas fa-heart fa-fw"></i><br>お気に入り追加
</button>
{% else %}
<button type="submit" id="favorite" disabled="disabled" class="d-block text-center full-width">
<i class="fas fa-heart fa-fw"></i> お気に入り済
</button>
{% endif %}
</form>
{% endif %}
</div>
<div class="col-3">
<a href="{{ url('product_contact') }}?product_id={{ Product.id }}" class="contact d-block text-center">商品について<br>問い合せる</a>
</div>
</div>
</nav>
<div class="modal fade" id="cartModal" tabindex="-1" role="dialog" aria-labelledby="cartModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">{{ Product.name }}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body" id="floating-nav-cart">
</div>
</div>
</div>
</div>
{% endif %}