{#
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 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 %}
<!-- PAGE CONTENTS -->
<div class="products productsIndex">
<section class="sub-container">
<!-- H1 商品カテゴリーの見出し -->
<div class="sub-h1--products">
<h1 class="itemTitle" style="color: #221613;">
{% 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 %}
{% if(subtitle == "全商品") %}
商品一覧
{% else %}
{{ subtitle }}
{% endif %}
{% elseif title is defined and title is not empty %}
{{ title }}
{% endif %}
</h1>
<div class="itemImg">
<div class="itemImgInner">
<img src="{{ asset('assets/img/products/sub_h1_02.jpg') }}" alt="香り芽本舗の商品一覧" class="imgObjectFitCover">
</div>
</div>
</div>
<!-- /H1 -->
<!-- CONTENTS -->
<div class="l-container l-2ColumnContainer">
<!-- MAIN-CONTENTS -->
<div class="l-main">
<!-- BREAD CRUMBS -->
<div class="sub-breadcrumbsWrap">
<ul class="sub-breadcrumbs">
<li><a href="#">TOP</a></li>
<li>商品一覧</li>
</ul>
</div>
<!-- /BREAD CRUMBS -->
<!-- MAIN CONTENTS -->
<section>
{% 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>
<!-- HED -->
<div class="products-listHed">
<h2 class="mod-hl-01">商品一覧</h2>
<div class="boxSortBtnWrap">
{% if pagination.totalItemCount > 0 %}
<div class="boxSortBtn boxSortBtn-number">
{{ form_widget(search_form.disp_number, {'id': '', 'attr': {'class': 'disp-number mod-form-select form-control'}}) }}
</div>
<div class="boxSortBtn boxSortBtn-orderBy">
{{ form_widget(search_form.orderby, {'id': '', 'attr': {'class': 'order-by mod-form-select form-control'}}) }}
</div>
{% endif %}
</div>
</div>
<!-- /HED -->
<div class="ec-searchnavRole__infos marginBottom40">
<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>
</div>
<!-- LIST -->
<div class="products-listList mod-productsBoxContainer">
{% if pagination.totalItemCount > 0 %}
{% for Product in pagination %}
<!-- BOX -->
<article class="mod-productsBox">
<a href="{{ url('product_detail', {'id': Product.id}) }}" class="mod-productsBoxInner">
<span class="boxImg">
<span class="boxImgInner">
<img src="{{ asset(Product.main_list_image|no_image_product, 'save_image') }}" alt="{{ Product.name }}" class="imgObjectFitCover" loading="lazy">
</span>
</span>
<div class="boxData">
<h3 class="name">{{ Product.name }}</h3>
{# 販売価格 #}
<p class="price">
{% if Product.getPrice01Min is not null %}
{% set priceClass = "color: #f00;font-weight: bold;font-size: 17px;text-align:right;" %}
{% else %}
{% set priceClass = "" %}
{% endif %}
<div style="{{ priceClass }}">
{% if Product.hasProductClass %}
{% if Product.getPrice02Min == Product.getPrice02Max %}
{{ Product.getPrice02IncTaxMin|number_format }}
{% else %}
{{ Product.getPrice02IncTaxMin|number_format }}
~
{{ Product.getPrice02IncTaxMax|number_format }}
{% endif %}
円
<small class="isSmall" style="font-size: 15px;">(税込)</small>
{% else %}
{{ Product.getPrice02IncTaxMin|number_format }}
円
<small class="isSmall" style="font-size: 15px;">(税込)</small>
{% endif %}
</div>
<div class="font13 textRight" style="margin-top:10px;text-decoration: line-through;">
{% if Product.hasProductClass %}
<div>
{% if Product.getPrice01Min is not null and Product.getPrice01IncTaxMin == Product.getPrice01IncTaxMax %}
{{ Product.getPrice01IncTaxMin|number_format }}円
<span class="tax">(税込)</span>
{% elseif Product.getPrice01Min is not null and Product.getPrice01Max is not null %}
{{ Product.getPrice01IncTaxMin|number_format }}~ {{ Product.getPrice01IncTaxMax|number_format }}円
<span class="tax">(税込)</span>
{% endif %}
</div>
{% else %}
{% if Product.getPrice01Max is not null %}
{{ Product.getPrice01IncTaxMin|number_format }}円
<span class="tax">(税込)</span>
{% endif %}
{% endif %}
</div>
</p>
{% if Product.stock_find %}
{% else %}
<div class="ec-productRole__btn">
<button type="button" class="ec-blockBtn--action" disabled="disabled">
{{ 'ただいま品切れ中です。'|trans }}
</button>
</div>
{% endif %}
</div>
</a>
</article>
<!-- /BOX -->
{% endfor %}
{% endif %}
</div>
<!-- /LIST -->
<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>
{% endif %}
</section>
<!-- /MAIN CONTENTS -->
<!-- PAGINATION -->
{% include "pager.twig" with {'pages': pagination.paginationData} %}
<!-- /PAGINATION -->
{% if Layout.MainBottom %}
{{ include('block.twig', {'Blocks': Layout.MainBottom}) }}
{% endif %}
</div>
<!-- /MAIN-CONTENTS -->
<!-- SIDE-CONTENTS -->
{{ include('Block/side_menu.twig') }}
<!-- /SIDE-CONTENTS -->
</div>
<!-- /CONTENTS -->
</section>
</div>
<!-- /PAGE CONTENTS -->
<style>
.ec-blockBtn--action {
height: 30px;
line-height: 100%;
margin-top: 15px;
font-size: 12px;
}
</style>
{% endblock %}