{#
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.
#}
{% set sidbar_out = false %}
{% set sidebar_type = 0 %}
{# 商品一覧からの場合 #}
{% if Category is defined %}
{% if Category is not null %}
{% for Path in Category.path %}
{% if Path.hierarchy == 1 %}
{% if Path.name == '部品' %}
{% set sidebar_type = 1 %}
{% set sidbar_out = true %}
{% endif %}
{% if Path.name == 'カートリッジ' %}
{% set sidebar_type = 2 %}
{% set sidbar_out = true %}
{% endif %}
{% if Path.name == '取付工事' %}
{% set sidebar_type = 3 %}
{% set sidbar_out = true %}
{% endif %}
{% endif %}
{% endfor %}
{% else %}
{% set sidebar_type = 999 %}
{% endif %}
{% endif %}
{% extends 'default_frame.twig' %}
{% set body_class = 'product_page' %}
{% block javascript %}
<script>
eccube.productsClassCategories = {
{% for Product in pagination %}
"{{ Product.id|escape('js') }}": {{ class_categories_as_json(Product)|raw }}{% if loop.last == false %}, {% endif %}
{% endfor %}
};
$(function() {
// 表示件数を変更
$('.disp-number').change(function() {
var dispNumber = $(this).val();
$('#disp_number').val(dispNumber);
$('#pageno').val(1);
$("#form1").submit();
});
// 並び順を変更
$('.order-by').change(function() {
var orderBy = $(this).val();
$('#orderby').val(orderBy);
$('#pageno').val(1);
$("#form1").submit();
});
$('.add-cart').on('click', function(e) {
var $form = $(this).parents('li').find('form');
// 個数フォームのチェック
var $quantity = $form.parent().find('.quantity');
if ($quantity.val() < 1) {
$quantity[0].setCustomValidity('{{ '1以上で入力してください。'|trans }}');
setTimeout(function() {
loadingOverlay('hide');
}, 100);
return true;
} else {
$quantity[0].setCustomValidity('');
}
e.preventDefault();
$.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').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);
});
});
$('input.quantity').hide();
$('input.quantity').prev().hide();
$('select[name="classcategory_id1"]').hide();
$('select[name="classcategory_id2"]').hide();
$('select[name="classcategory_id3"]').hide();
$('select[name="classcategory_id4"]').hide();
$('select[name="classcategory_id5"]').hide();
$('#classcategory_id2').hide();
$('#classcategory_id3').hide();
$('#classcategory_id4').hide();
$('#classcategory_id5').hide();
$('.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>
{% endblock %}
{% block main %}
<style>
.ec-shelfGrid .ec-shelfGrid__item-image{
height: auto;
}
.ec-productRole__tag{
text-align: justify;
display: inline-block;
background-color: #ebf0f0;
padding: 1px 1px !important;
font-size: 90%;
margin-right: 5px;
}
.ec-shelfGrid .ec-shelfGrid__item {
margin-bottom: 36px;
width: 100%;
display: -ms-flexbox;
display: flex;
-ms-flex-direction: column;
flex-direction: column;
}
@media only screen and (min-width: 768px){
.ec-shelfGrid .ec-shelfGrid__item{
padding: 0 16px;
{% if sidebar_type == 1 or sidebar_type == 2 or sidebar_type == 3 or sidebar_type == 999 %}
width: 25%;
{% else %}
width: 33%;
{% endif %}
}
}
</style>
{% if search_form.category_id.vars.errors|length > 0 %}
<div class="ec-searchnavRole">
<p class="errormsg text-danger">{{ 'ご指定のカテゴリは存在しません'|trans }}</p>
</div>
{% else %}
<div class="ec-searchnavRole">
<form name="form1" id="form1" method="get" action="?">
{% for item in search_form %}
<input type="hidden" id="{{ item.vars.id }}"
name="{{ item.vars.full_name }}"
{% if item.vars.value is not empty %}value="{{ item.vars.value }}" {% endif %}/>
{% endfor %}
</form>
<div class="ec-searchnavRole__topicpath">
<ol class="ec-topicpath">
{# <li class="ec-topicpath__item"><a href="{{ url('product_list') }}">{{ '全て'|trans }}</a> #}
{# </li> #}
{% if Category is not null %}
{% for Path in Category.path %}
{# <li class="ec-topicpath__divider">|</li> #}
<li class="ec-topicpath__item{% if loop.last %}--active{% endif %}"><a
href="{{ url('product_list') }}?category_id={{ Path.id }}">{{ Path.name }}</a>
</li>
<li class="ec-topicpath__divider">|</li>
{% endfor %}
{% endif %}
{#{% if search_form.vars.value and search_form.vars.value.name %}#}
{# <li class="ec-topicpath__divider">|</li>#}
{# <li class="ec-topicpath__item">{{ '「%name%」の検索結果'|trans({ '%name%': search_form.vars.value.name }) }}</li>#}
{#{% endif %}#}
</ol>
</div>
<div class="ec-searchnavRole__infos">
{#<div class="ec-searchnavRole__counter">#}
{# {% if pagination.totalItemCount > 0 %}#}
{# {{ '<span class="ec-font-bold">%count%件</span><span>の商品が見つかりました</span>'|trans({ '%count%': pagination.totalItemCount })|raw }}#}
{# {% else %}#}
{# <span>{{ 'お探しの商品は見つかりませんでした'|trans }}</span>#}
{# {% endif %}#}
{#</div>#}
{#{% if pagination.totalItemCount > 0 %}#}
{# <div class="ec-searchnavRole__actions">#}
{# <div class="ec-select">#}
{# {{ form_widget(disp_number_form, {'id': '', 'attr': {'class': 'disp-number'}}) }}#}
{# {{ form_widget(order_by_form, {'id': '', 'attr': {'class': 'order-by'}}) }}#}
{# </div>#}
{# </div>#}
{#{% endif %}#}
</div>
</div>
{% if pagination.totalItemCount > 0 %}
<div class="ec-shelfRole">
<ul class="ec-shelfGrid">
{% for Product in pagination %}
<li class="ec-shelfGrid__item">
<p class="ec-shelfGrid__item-image">
<a href="{{ url('product_detail', {'id': Product.id}) }}">
<p class="ec-shelfGrid__item-image">
<img src="{{ asset(Product.main_list_image|no_image_product, 'save_image') }}" alt="{{ Product.name }}" loading="lazy">
</p>
{# 部品の場合 #}
{% if sidebar_type == 1 %}
{% if Product.code_min is not empty %}
{#<p style="font-size: 12px;">型番<br /></p>#}
<span class="product-code-default">{{ Product.code_min }}{% if Product.code_min != Product.code_max %} ~ {{ Product.code_max }}{% endif %}</span>
{% endif %}
{% endif %}
<p>{{ Product.name }}</p>
{% if Product.description_list %}
<p>{{ Product.description_list|raw|nl2br }}</p>
{% endif %}
<p>
{% set flgRental = false %}
{% for class in Product.ProductClasses %}
{% if CustomSaleType[class.SaleType.Id] is defined %}
{% if CustomSaleType[class.SaleType.Id].Rental %}
{% set flgRental = true %}
{% endif %}
{% endif %}
{% endfor %}
{% if flgRental %}
レンタル月額
{% endif %}
</p>
<p class="xxxx">
{{ Product.getPrice02IncTaxMax|number_format }}円税込
</p>
<p class="xxxx">
{% if Product.hasProductClass %}
{% if Product.getPrice02Min == Product.getPrice02Max %}
{% else %}
<span class="txt" style="font-size: 10px;">(オートシップメント契約価格{{ Product.getPrice02IncTaxMin|number_format }}円税込)</span>
{% endif %}
{% else %}
{% endif %}
</p>
{# タグ #}
<ul class="ec-productRole__tags">
{% for Tag in Product.Tags %}
<li class="ec-productRole__tag tag_{{ Tag.id }}">{{ Tag }}</li>
{% if loop.last %}
{% else %}
/
{% endif %}
{% endfor %}
</ul>
{# タグ #}
{% if Product.stock_find %}
{#{% set form = forms[Product.id] %}#}
{#<form name="form{{ Product.id }}" id="productForm{{ Product.id }}" action="{{ url('product_add_cart', {id:Product.id}) }}" method="post">#}
{#<div class="ec-productRole__actions">#}
{#{% if form.classcategory_id1 is defined %}#}
{#<div class="ec-select">#}
{#{{ form_widget(form.classcategory_id1) }}#}
{#{{ form_errors(form.classcategory_id1) }}#}
{#</div>#}
{#{% if form.classcategory_id2 is defined %}#}
{#<div class="ec-select">#}
{#{{ form_widget(form.classcategory_id2) }}#}
{#{{ form_errors(form.classcategory_id2) }}#}
{#</div>#}
{#{% endif %}#}
{#{% endif %}#}
{#<div class="ec-numberInput"><span>{{ '数量'|trans }}</span>#}
{#{{ form_widget(form.quantity, {'attr': {'class': 'quantity'}}) }}#}
{#{{ form_errors(form.quantity) }}#}
{#</div>#}
{#</div>#}
{#{{ form_rest(form) }}#}
{#</form>#}
<div class="ec-productRole__btn">
{#{% set flgCartridge = false %}#}
{#{% for class in Product.ProductClasses %}#}
{# {% if CustomSaleType[class.SaleType.Id] is defined %}#}
{# {% if CustomSaleType[class.SaleType.Id].ExchageCartridge %}#}
{# {% set flgCartridge = true %}#}
{# {% endif %}#}
{# {% endif %}#}
{#{% endfor %}#}
{#{% if Product.IsChangeCartridge %}#}
{# {% if flgCartridge %}#}
{# <p style="color:red">{{ 'customize.cartridge.replacement.supplement.message'|trans }}</p>#}
{# {% endif %}#}
{#{% endif %}#}
{#{% if Product.IsRental %}#}
{#{% else %}#}
{#<button type="submit" class="ec-blockBtn--action add-cart" data-cartid="{{ Product.id }}" form="productForm{{ Product.id }}">#}
{# {{ 'カートに入れる'|trans }}#}
{#</button>#}
{#{% endif %}#}
</div>
{% else %}
{#<div class="ec-productRole__btn">#}
{# <button type="button" class="ec-blockBtn--action" disabled="disabled">#}
{# {{ 'ただいま品切れ中です。'|trans }}#}
{# </button>#}
{#</div>#}
{% endif %}
</li>
{% endfor %}
</ul>
</div>
<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-pagerRole">
{% include "pager.twig" with {'pages': pagination.paginationData} %}
</div>
{% endif %}
{% endif %}
{% endblock %}