{#
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>
.mod-form-select.form-select {
width: 100% !important;
}
</style>
{% endblock %}
{% 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').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);
});
});
});
$('.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 %}
<div
class="sub-container">
<!-- SUB H1 -->
<div
class="sub-h1Wrap">
<h1 class="sub-h1">
{% if subtitle is defined and subtitle is not empty %}
{# 「全商品」を除外 #}
{% if Category is not null %}
{# 親カテゴリ(「個人印鑑」など)を除外 #}
{% if Category.Parent is not null %}
{# 子カテゴリ(「実印」など)にのみ適用 #}
{{ Category.Parent.name }}
{% endif %}
{% endif %}
{{ subtitle }}
{% elseif title is defined and title is not empty %}
{{ title }}
{% endif %}
</h1>
</div>
<!-- /SUB H1 -->
<div
class="l-container">
<!-- パンくずリスト -->
<ol class="sub-breadcrumbs">
<li>
<a href="{{ url('homepage') }}">HOME</a>
</li>
{% if Category is not null %}
<li>
<a href="{{ url('product_list') }}">全商品</a>
</li>
{# 「全商品」を除外 #}
{% if Category is not null %}
{# 親カテゴリ(「個人印鑑」など)を除外 #}
{% if Category.Parent is not null %}
{# 子カテゴリ(「実印」など)にのみ適用 #}
<li>
<a href="{{ url('product_list') }}?category_id={{ Category.Parent.id }}">{{ Category.Parent.name }}</a>
</li>
{% endif %}
{% endif %}
{% endif %}
<li>
{% if subtitle is defined and subtitle is not empty %}
{{ subtitle }}
{% elseif title is defined and title is not empty %}
{{ title }}
{% endif %}
</li>
</ol>
<!-- /パンくずリスト -->
<div
class="l-2ColumnContainer">
<!-- メインコンテンツ -->
<div
class="l-main">
<!-- PAGE CONTENTS -->
<div class="products productsList">
{% if search_form.category_id.vars.errors|length > 0 %}
<div class="ec-searchnavRole">
<p class="errormsg text-danger">{{ 'ご指定のカテゴリは存在しません'|trans }}</p>
</div>
{% else %}
<section>
<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>
<h2 class="mod-hl-01 productsList-hl">
<span class="isJp">{% if subtitle is defined and subtitle is not empty %}{{ subtitle }}{% elseif title is defined and title is not empty %}{{ title }}{% endif %}</span>
</h2>
{% if pagination.totalItemCount > 0 %}
<!-- 並び替えform -->
<div class="productsList-sort-setting">
<form>
{{ form_widget(search_form.disp_number, {'id': '', 'attr': {'class': 'mod-form-select disp-number'}}) }}
{{ form_widget(search_form.orderby, {'id': '', 'attr': {'class': 'mod-form-select order-by'}}) }}
</form>
</div>
<!-- /並び替えform -->
{% endif %}
{% if pagination.totalItemCount > 0 %}
<div class="productsList-sort-result">
<div class="mod-products-list">
{% for Product in pagination %}
<article class="productsBox">
<a href="{{ url('product_detail', {'id': Product.id}) }}" class="productsBoxInner">
<span class="productsBox-img">
<span class="imgInner">
<img src="{{ asset(Product.main_list_image|no_image_product, 'save_image') }}" alt="{{ Product.name }}" {% if loop.index > 5 %} loading="lazy" {% endif %} class="imgObjectFitCover">
{% if not Product.stock_find %}
<div class="is-soldout">
<span>SOLD OUT</span>
</div>
{% endif %}
</span>
</span>
<h3 class="productsBox-hl">{{ Product.name }}</h3>
{% if Product.description_list %}
<p>{{ Product.description_list|raw|nl2br }}</p>
{% endif %}
{# 通常価格 #}
{% if Product.hasProductClass %}
<div class="ec-productRole__priceRegular" style="margin-top:10px;">
{% if Product.getPrice01Min is not null and Product.getPrice01IncTaxMin == Product.getPrice01IncTaxMax %}
<span class="ec-productRole__priceRegularPrice"><span class="price01-default" style="text-decoration:line-through;">{{ Product.getPrice01IncTaxMin|number_format }}円</span></span>
<span class="ec-productRole__priceRegularTax" style="text-decoration:line-through;">{{ '税込'|trans }}</span>
{% elseif Product.getPrice01Min is not null and Product.getPrice01Max is not null %}
<span class="ec-productRole__priceRegularPrice"><span class="price01-default" style="text-decoration:line-through;">{{ Product.getPrice01IncTaxMin|number_format }}~ {{ Product.getPrice01IncTaxMax|number_format }}円</span></span>
<span class="ec-productRole__priceRegularTax" style="text-decoration:line-through;">{{ '税込'|trans }}</span>
{% endif %}
</div>
{% else %}
{% if Product.getPrice01Max is not null %}
<span class="ec-productRole__priceRegularPrice" style="text-decoration:line-through;">{{ Product.getPrice01IncTaxMin|number_format }}円</span>
<span class="ec-productRole__priceRegularTax" style="text-decoration:line-through;">{{ '税込'|trans }}</span>
{% endif %}
{% endif %}
{# 販売価格 #}
<p class="productsBox-text" style="margin-top:0px;">
{% if Product.hasProductClass %}
{% if Product.getPrice02Min == Product.getPrice02Max %}
{{ Product.getPrice02IncTaxMin|number_format }}
{% else %}
{{ Product.getPrice02IncTaxMin|number_format }}
~
{{ Product.getPrice02IncTaxMax|number_format }}
{% endif %}
{% else %}
{{ Product.getPrice02IncTaxMin|number_format }}
{% endif %}
円<small class="isSmall">税込</small>
</p>
</a>
</article>
{% endfor %}
</div>
</div>
{% include "pager.twig" with {'pages': pagination.paginationData} %}
{% endif %}
<!-- 最近チェックした商品 -->
{{ include('Block/items_checked.twig', ignore_missing = true) }}
<!-- /最近チェックした商品 -->
</section>
{% endif %}
</div>
<!-- /PAGE CONTENTS -->
</div>
<!-- /メインコンテンツ -->
<!-- サイドメニュー -->
{{ include('Block/l_sub.twig', ignore_missing = true) }}
<!-- /サイドメニュー -->
</div>
</div>
</div>
<style>
.is-soldout{
background-color: rgba(0, 0, 0, 0.5);
text-align: center;
position: absolute;
color: #fff;
font-size: 1.8rem;
margin: 0 !important;
padding: 0 !important;
width: 100%;
height: 100%;
}
.is-soldout span{
position: relative;
display: block;
height: 100%;
top: 40%;
}
@media only screen and (min-width: 600px)and (max-width: 1023px){
.is-soldout{
font-size: 1.3rem;
}
}
</style>
{% endblock %}