{#
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 %}
<link rel="stylesheet" href="/html/plugins/ion-rangeslider/css/ion.rangeSlider.min.css">
<style>
/* ============================================
サイドバー付き 2カラムレイアウト
============================================ */
.ec-productListLayout {
display: flex;
gap: 32px;
align-items: flex-start;
}
/* ============================================
サイドバー(フィルターパネル)
============================================ */
.ec-filterSidebar {
position: static;
margin: 20px;
width: 240px;
flex-shrink: 0;
}
@media (min-width: 767px) {
.ec-searchnavRole {
margin-left: calc((100% - 1130px - 280px) / 2);
}
.ec-shelfRole {
margin-left: calc((100% - 1130px - 280px) / 2);
}
.ec-pagerRole {
margin-left: calc((100% - 1130px - 280px) / 2);
}
}
.ec-filterSidebar__section {
background: #fff;
border: 1px solid #e8e8e8;
border-radius: 6px;
padding: 18px 16px;
margin-bottom: 16px;
}
.ec-filterSidebar__heading {
font-size: 13px;
font-weight: bold;
color: #222;
margin: 0 0 12px;
padding-bottom: 10px;
border-bottom: 2px solid #222;
letter-spacing: 0.05em;
}
/* カテゴリリスト */
.ec-filterSidebar__categoryList,
.ec-filterSidebar__categoryList ul {
list-style: none;
padding: 0;
margin: 0;
}
.ec-filterSidebar__categoryList li a {
display: block;
padding: 6px 8px;
font-size: 13px;
color: #444;
text-decoration: none;
border-radius: 4px;
transition: background 0.15s, color 0.15s;
}
.ec-filterSidebar__categoryList li a:hover {
background: #f5f5f5;
color: #222;
}
.ec-filterSidebar__categoryList li.is-active > a {
font-weight: bold;
color: #c00;
background: #fff5f5;
}
/* サブカテゴリ */
.ec-filterSidebar__categoryList ul {
padding-left: 12px;
margin-top: 2px;
}
.ec-filterSidebar__categoryList ul li a {
font-size: 12px;
color: #666;
padding: 4px 8px;
}
/* メーカーリスト */
.ec-filterSidebar__makerList {
list-style: none;
padding: 0;
margin: 0;
}
.ec-filterSidebar__makerList li {
border-bottom: 1px solid #f0f0f0;
}
.ec-filterSidebar__makerList li:last-child {
border-bottom: none;
}
.ec-filterSidebar__makerList li a {
display: flex;
align-items: center;
gap: 6px;
padding: 7px 6px;
font-size: 13px;
color: #444;
text-decoration: none;
transition: color 0.15s;
}
.ec-filterSidebar__makerList li a:hover {
color: #c00;
}
.ec-filterSidebar__makerList li.is-active a {
font-weight: bold;
color: #c00;
}
.ec-filterSidebar__makerList li.is-active a::before {
content: "✓";
font-size: 11px;
color: #c00;
}
/* 価格帯フィルター */
.ec-filterSidebar__priceDisplay {
text-align: center;
font-size: 13px;
color: #333;
margin-bottom: 12px;
font-weight: bold;
}
.ec-filterSidebar__priceDisplay span {
color: #c00;
}
.ec-filterSidebar__priceSliderWrap {
padding: 0 4px;
margin-bottom: 16px;
}
.ec-filterSidebar__priceApply {
display: block;
width: 100%;
padding: 8px;
background: #222;
color: #fff;
border: none;
border-radius: 4px;
font-size: 13px;
cursor: pointer;
text-align: center;
transition: background 0.2s;
}
.ec-filterSidebar__priceApply:hover {
background: #444;
}
.ec-filterSidebar__pricePreset {
list-style: none;
padding: 0;
margin: 10px 0 0;
}
.ec-filterSidebar__pricePreset li a {
display: block;
padding: 5px 6px;
font-size: 12px;
color: #666;
text-decoration: none;
border-radius: 4px;
transition: background 0.15s;
}
.ec-filterSidebar__pricePreset li a:hover {
background: #f5f5f5;
color: #333;
}
/* 絞り込みリセット */
.ec-filterSidebar__reset a {
display: block;
text-align: center;
padding: 8px;
font-size: 12px;
color: #888;
text-decoration: underline;
border: 1px solid #ddd;
border-radius: 4px;
transition: color 0.15s, border-color 0.15s;
}
.ec-filterSidebar__reset a:hover {
color: #c00;
border-color: #c00;
}
/* 現在の絞り込み条件バッジ */
.ec-filterActive {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin-bottom: 12px;
padding: 10px 12px;
background: #f9f9f9;
border: 1px solid #e8e8e8;
border-radius: 6px;
}
.ec-filterActive__label {
font-size: 11px;
color: #888;
align-self: center;
margin-right: 4px;
}
.ec-filterActive__tag {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 3px 8px;
background: #222;
color: #fff;
border-radius: 20px;
font-size: 11px;
}
.ec-filterActive__tag a {
color: #aaa;
text-decoration: none;
font-size: 12px;
line-height: 1;
}
.ec-filterActive__tag a:hover {
color: #fff;
}
/* メインコンテンツ側 */
.ec-productListMain {
flex: 1;
min-width: 0;
width: 100%;
}
/* ion-rangeslider カスタマイズ */
.irs--flat .irs-bar {
background-color: #222;
}
.irs--flat .irs-handle > i:first-child {
background-color: #222;
}
.irs--flat .irs-from,
.irs--flat .irs-to,
.irs--flat .irs-single {
background-color: #222;
font-size: 11px;
}
/* モバイル対応 */
@media (max-width: 767px) {
/* 横スクロール禁止 */
body, html {
overflow-x: hidden;
max-width: 100vw;
}
.ec-productListLayout {
flex-direction: column;
gap: 0;
}
.ec-filterSidebar {
width: 100%;
margin: 0;
}
/* スマホで商品一覧を確実に表示 */
.ec-productListMain {
width: 100%;
flex: none;
margin: 0;
}
.ec-filterSidebar__section {
margin-bottom: 10px;
}
/* モバイルではアコーディオン形式 */
.ec-filterSidebar__body {
display: none;
}
.ec-filterSidebar__body.is-open {
display: block;
}
.ec-filterSidebar__heading {
cursor: pointer;
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 0;
padding-bottom: 0;
border-bottom: none;
}
.ec-filterSidebar__heading.is-open {
margin-bottom: 12px;
padding-bottom: 10px;
border-bottom: 2px solid #222;
}
.ec-filterSidebar__heading::after {
content: "▼";
font-size: 10px;
color: #888;
transition: transform 0.2s;
}
.ec-filterSidebar__heading.is-open::after {
transform: rotate(180deg);
}
}
</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();
});
// ==============================
// 価格帯スライダー(ion-rangeslider)
// ==============================
var priceMin = parseInt('{{ app.request.query.get("price_min") ?: 0 }}') || 0;
var priceMax = parseInt('{{ app.request.query.get("price_max") ?: 5000000 }}') || 5000000;
$("#price-range-slider").ionRangeSlider({
type: "double",
min: 0,
max: 5000000,
from: priceMin,
to: priceMax,
step: 10000,
prettify_enabled: true,
prettify_separator: ",",
postfix: "円",
onFinish: function(data) {
$('#price_min_val').val(data.from);
$('#price_max_val').val(data.to);
// 表示更新
$('#price-display-min').text(Number(data.from).toLocaleString());
$('#price-display-max').text(Number(data.to).toLocaleString());
}
});
// 価格フォーム送信
$('#price-filter-apply').on('click', function() {
var min = $('#price_min_val').val();
var max = $('#price_max_val').val();
var url = new URL(window.location.href);
url.searchParams.set('price_min', min);
url.searchParams.set('price_max', max);
url.searchParams.delete('pageno');
window.location.href = url.toString();
});
// モバイル:アコーディオン(初期状態を閉じる)
function initMobileAccordion() {
if ($(window).width() <= 767) {
$('.ec-filterSidebar__heading').removeClass('is-open');
$('.ec-filterSidebar__body').removeClass('is-open');
}
}
initMobileAccordion();
$(window).on('resize', initMobileAccordion);
$('.ec-filterSidebar__heading').on('click', function() {
if ($(window).width() <= 767) {
$(this).toggleClass('is-open');
$(this).next('.ec-filterSidebar__body').toggleClass('is-open');
}
});
});
$('.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()
});
// 価格プリセットのクイック適用
function applyPrice(min, max) {
var url = new URL(window.location.href);
url.searchParams.set('price_min', min);
url.searchParams.set('price_max', max);
url.searchParams.delete('pageno');
window.location.href = url.toString();
}
</script>
<script src="/html/plugins/ion-rangeslider/js/ion.rangeSlider.min.js"></script>
{% endblock %}
{% block main %}
{% set hasFilter = app.request.query.get('category_id') or app.request.query.get('maker_id') or app.request.query.get('price_min') or app.request.query.get('price_max') %}
{# ==============================
2カラムレイアウト本体
============================== #}
<div class="ec-productListLayout">
{# ===== サイドバー(左カラム)===== #}
<aside class="ec-filterSidebar">
{# ----- 価格帯 ----- #}
<div class="ec-filterSidebar__section">
<h3 class="ec-filterSidebar__heading">価格帯</h3>
<div class="ec-filterSidebar__body is-open">
<div class="ec-filterSidebar__priceDisplay">
<span id="price-display-min">{{ app.request.query.get('price_min') ? app.request.query.get('price_min')|number_format : '0' }}</span>円
〜
<span id="price-display-max">{{ app.request.query.get('price_max') ? app.request.query.get('price_max')|number_format : '5,000,000' }}</span>円
</div>
<div class="ec-filterSidebar__priceSliderWrap">
<input type="text" id="price-range-slider" style="display:none;">
<input type="hidden" id="price_min_val" value="{{ app.request.query.get('price_min') ?: 0 }}">
<input type="hidden" id="price_max_val" value="{{ app.request.query.get('price_max') ?: 5000000 }}">
</div>
<button id="price-filter-apply" class="ec-filterSidebar__priceApply">この価格帯で絞り込む</button>
<ul class="ec-filterSidebar__pricePreset">
<li><a href="javascript:void(0);" onclick="applyPrice(0, 300000)">〜30万円</a></li>
<li><a href="javascript:void(0);" onclick="applyPrice(300000, 600000)">30万円〜60万円</a></li>
<li><a href="javascript:void(0);" onclick="applyPrice(600000, 1000000)">60万円〜100万円</a></li>
<li><a href="javascript:void(0);" onclick="applyPrice(1000000, 5000000)">100万円〜</a></li>
</ul>
</div>
</div>
{# ----- メーカー(ブランド)----- #}
<div class="ec-filterSidebar__section">
<h3 class="ec-filterSidebar__heading">ブランド</h3>
<div class="ec-filterSidebar__body is-open">
<ul class="ec-filterSidebar__makerList">
{% if Makers is defined %}
{% for MakerItem in Makers %}
<li class="{{ Maker is not null and Maker.id == MakerItem.id ? 'is-active' : '' }}">
<a href="{{ url('product_list') }}?maker_id={{ MakerItem.id }}{% if app.request.query.get('category_id') %}&category_id={{ app.request.query.get('category_id') }}{% endif %}">
{{ MakerItem.name }}
</a>
</li>
{% endfor %}
{% else %}
{# Makersがコントローラから渡されない場合は静的リストで対応 #}
{% set makerList = [
{id: 1, name: 'LIXIL'},
{id: 2, name: 'YKK AP'},
{id: 3, name: '三協アルミ'},
{id: 4, name: '四国化成'},
{id: 5, name: 'タカショー'},
{id: 6, name: 'ユニソン'},
{id: 7, name: 'エスビック'},
{id: 8, name: 'パナソニック'},
{id: 9, name: 'イナバ'},
{id: 10, name: 'ヨドコウ'},
{id: 13, name: 'タクボ'}
] %}
{% for maker in makerList %}
<li class="{{ Maker is not null and Maker.id == maker.id ? 'is-active' : '' }}">
<a href="{{ url('product_list') }}?maker_id={{ maker.id }}{% if app.request.query.get('category_id') %}&category_id={{ app.request.query.get('category_id') }}{% endif %}">
{{ maker.name }}
</a>
</li>
{% endfor %}
{% endif %}
</ul>
</div>
</div>
{# ----- カテゴリ ----- #}
<div class="ec-filterSidebar__section">
<h3 class="ec-filterSidebar__heading">カテゴリ</h3>
<div class="ec-filterSidebar__body is-open">
{% set categoryList = [
{id: 7, name: 'カーポート・車庫', children: []},
{id: 16, name: 'ガレージ・倉庫', children: []},
{id: 8, name: 'サイクルポート・駐輪場', children: []},
{id: 9, name: 'ゲート', children: [
{id: 30, name: '跳ね上げ式ゲート'},
{id: 29, name: '伸縮ゲート'},
{id: 31, name: 'ガレージシャッター'}
]},
{id: 12, name: 'テラス', children: [
{id: 33, name: 'テラス囲い'},
{id: 32, name: 'テラス屋根'}
]},
{id: 19, name: 'ベランダ・バルコニー', children: [
{id: 35, name: 'ベランダ・バルコニー屋根'},
{id: 34, name: 'ベランダ・バルコニー'}
]},
{id: 18, name: 'オーニング・日よけ', children: []},
{id: 11, name: 'ウッドデッキ', children: [
{id: 37, name: 'タイルデッキ'},
{id: 36, name: 'ウッドデッキ'}
]},
{id: 14, name: 'フェンス・柵', children: []},
{id: 25, name: '門扉', children: []},
{id: 13, name: 'ポスト・門柱宅配ボックス', children: []},
{id: 15, name: '物置・収納・屋外倉庫', children: []},
{id: 20, name: 'ガーデンファニチャー', children: []},
{id: 22, name: '人工芝', children: []},
{id: 17, name: '内窓・二重窓', children: []},
{id: 26, name: 'その他', children: [
{id: 38, name: 'パーゴラ'},
{id: 39, name: '立水栓・ガーデンシンク'},
{id: 40, name: '手すり'},
{id: 10, name: 'ストックヤード'},
{id: 27, name: 'ゴミステーション'},
{id: 42, name: '面格子・窓格子'},
{id: 41, name: '窓シャッター'},
{id: 43, name: '玄関ドア'},
{id: 28, name: '石材'},
{id: 44, name: '照明'},
{id: 21, name: 'DIY材料'}
]}
] %}
<ul class="ec-filterSidebar__categoryList">
<li class="{{ app.request.query.get('category_id') is empty and Maker is null ? 'is-active' : '' }}">
<a href="{{ url('product_list') }}">すべて</a>
</li>
{% for cat in categoryList %}
<li class="{{ app.request.query.get('category_id') == cat.id ? 'is-active' : '' }}">
<a href="{{ url('product_list') }}?category_id={{ cat.id }}{% if app.request.query.get('maker_id') %}&maker_id={{ app.request.query.get('maker_id') }}{% endif %}">
{{ cat.name }}
</a>
{% if cat.children|length > 0 %}
<ul>
{% for child in cat.children %}
<li class="{{ app.request.query.get('category_id') == child.id ? 'is-active' : '' }}">
<a href="{{ url('product_list') }}?category_id={{ child.id }}{% if app.request.query.get('maker_id') %}&maker_id={{ app.request.query.get('maker_id') }}{% endif %}">
{{ child.name }}
</a>
</li>
{% endfor %}
</ul>
{% endif %}
</li>
{% endfor %}
</ul>
</div>
</div>
{# ----- リセット ----- #}
{% if hasFilter %}
<div class="ec-filterSidebar__reset">
<a href="{{ url('product_list') }}">絞り込みをすべてリセット</a>
</div>
{% endif %}
</aside>
{# / サイドバー #}
{# ===== 商品一覧(右カラム)===== #}
<div class="ec-productListMain">
{% if search_form.category_id.vars.errors|length > 0 %}
<div class="ec-searchnavRole">
<p class="errormsg text-danger">{{ 'ご指定のカテゴリは存在しません'|trans }}</p>
</div>
{% else %}
{# 検索フォーム(hidden) #}
<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>
{% endfor %}
{% endif %}
{% if Maker is not null %}
<li class="ec-topicpath__divider">|</li>
<li class="ec-topicpath__item--active">
<a href="{{ url('product_list') }}?maker_id={{ Maker.id }}">{{ Maker.name }}</a>
</li>
{% 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>
{# ==============================
現在の絞り込み条件バッジ
============================== #}
{% if hasFilter %}
<div class="ec-filterActive">
<span class="ec-filterActive__label">絞り込み中:</span>
{% if Category is not null %}
{% set removeCategoryParam = 'category_id=' ~ app.request.query.get('category_id') %}
<span class="ec-filterActive__tag">
{{ Category.name }}
<a href="{{ app.request.uri|replace({(removeCategoryParam): ''}) }}" title="解除">✕</a>
</span>
{% endif %}
{% if Maker is not null %}
<span class="ec-filterActive__tag">
{{ Maker.name }}
<a href="{{ url('product_list') }}{% if app.request.query.get('category_id') %}?category_id={{ app.request.query.get('category_id') }}{% endif %}" title="解除">✕</a>
</span>
{% endif %}
{% if app.request.query.get('price_min') or app.request.query.get('price_max') %}
<span class="ec-filterActive__tag">
{% if app.request.query.get('price_min') %}{{ app.request.query.get('price_min')|number_format }}円{% else %}0円{% endif %}
〜
{% if app.request.query.get('price_max') %}{{ app.request.query.get('price_max')|number_format }}円{% else %}上限なし{% endif %}
<a href="javascript:void(0);" onclick="
var url = new URL(window.location.href);
url.searchParams.delete('price_min');
url.searchParams.delete('price_max');
window.location.href = url.toString();
" title="解除">✕</a>
</span>
{% endif %}
</div>
{% endif %}
{# 件数・並び順 #}
<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(search_form.disp_number, {'id': '', 'attr': {'class': 'disp-number'}}) }}
{{ form_widget(search_form.orderby, {'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" style="position:relative;">
{% if BaseInfo.option_favorite_product %}
<div style="position:absolute;top:8px;right:20px;z-index:10;">
<form action="{{ url('product_add_favorite', {id:Product.id}) }}" method="post">
<button type="submit" id="favorite" class="favorite">♡</button>
</form>
</div>
{% endif %}
<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 }}" {% if loop.index > 5 %} loading="lazy"{% endif %}>
</p>
<h5><strong>{{ getProduct_field(Product.id,"related_keyword") }}</strong></h5>
<p class="price02-default">
{% 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 %}
</p>
</a>
{% if Product.stock_find %}
{% set form = forms[Product.id] %}
<form name="form{{ Product.id }}" id="productForm{{ Product.id }}" action="{{ url('product_detail', {id:Product.id}) }}" method="get">
<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" style="display:none;"><span>{{ '数量'|trans }}</span>
{{ form_errors(form.quantity) }}
</div>
</div>
<div class="ec-productRole__btn">
<button class="ec-blockBtn--action">
{{ 'お見積もり詳細はこちら'|trans }}
</button>
</div>
</form>
{% 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-pagerRole">
{% include "pager.twig" with {'pages': pagination.paginationData} %}
</div>
{% endif %}
</div>
{# / 商品一覧 #}
</div>
{# / ec-productListLayout #}
{% endif %}
{% endblock %}