{#
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>
// 検索後パラメータをフォームにセット
function getParam(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
//商品名 or 型番入力検索
$("input[name='name']").val(getParam('name'));
//電源
var tag = getParam('tag');
if (tag) {
var tagId='tag_id_' + tag ;
var sel = document.querySelector('[data-id="' + tagId + '"]');
sel.selected = true;
}
var urlParams = new URLSearchParams(window.location.search);
var categoryIds = urlParams.getAll('category_ids[]');
//カテゴリ
for (i = 0; i < categoryIds.length; i++) {
if (categoryIds[i]!="") {
var cat='category_id_' + categoryIds[i] ;
var sel = document.querySelector('[data-id="' + cat + '"]');
var type = sel.getAttribute("type");
if (type=="radio") {
sel.checked= true;;
}else{
sel.selected = true;
}
}
}
/*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();
});
});
</script>
{% endblock %}
{% set catIds = app.request.get('category_ids') %}
{% set cid = "" %}
{% set cnt = 0 %}
{% for catId in catIds %}
{% if catId !="" %}
{% set cnt = cnt + 1 %}
{% set cid = catId %}
{% endif %}
{% endfor %}
{% if cnt == 1 %}
{% set Category = repository('Eccube\\Entity\\Category').find(cid) %}
{% endif %}
{% block title %}
<h1 class="c-title-06">
<span class="s-text">
{% if cnt == 1 %}
{{ Category.name }}のエアコン商品一覧{# カテゴリーページ #}
{% else %}
エアコン商品一覧
{% endif %}
</span>
</h1>
{% endblock %}
{% block main_head %}
{% if cnt == 1 %}
<div class="c-section">
<div class="c-media-01">
{% if Category.category_image %}
<figure class="s-image">
<div class="s-image__in">
<img src="{{ asset(Category.category_image|no_image_product, 'save_image') }}" alt="{{ Category.name }}">
</div>
</figure>
{% endif %}
<div class="s-content">
<h2 class="s-title">{{ Category.name }}の業務用エアコンの特長</h2>
{% if Category and Category.free_area %}
<div class="s-text">
{{ include(template_from_string(Category. free_area)) }}
</div>
{% endif %}
</div>
</div>
</div>
{% endif %}
{% endblock %}
{% block main %}
<div class="c-section">
<h3 class="c-title-07"><span class="s-text">{% if cnt == 1 %}{{ Category.name }}のエアコン{% endif %}商品一覧</span></h3>
{% 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 %}
{# タグの複数検索に対応 @see https://umebius.com/eccube/product_list_tag_search/ #}
{% if item.vars.value is iterable %}
{% for val in item.vars.value %}
<input type="hidden" id="{{ item.vars.id }}"
name="{{ item.vars.full_name }}[]" value="{{ val }}"/>
{% endfor %}
{% else %}
<input type="hidden" id="{{ item.vars.id }}"
name="{{ item.vars.full_name }}"
{% if item.vars.value is not empty %}value="{{ item.vars.value }}" {% endif %}/>
{% endif %}
{% endfor %}
</form>
<div class="p-products-list-head">
{% if pagination.totalItemCount > 0 %}
<div class="c-total-wrap">
{{ '<p class="c-total-num"><span class="s-main font-en">%count%</span><span class="s-sub">件</span></p>の商品がございます'|trans({ '%count%': pagination.totalItemCount })|raw }}
</div>
<div class="c-change-num">
<span class="s-text">表示件数</span>
{{ form_widget(search_form.disp_number, {'id': '', 'attr': {'class': 'disp-number'}}) }}
</div>
{% else %}
<div class="c-total-wrap"><span>{{ 'お探しの商品は見つかりませんでした'|trans }}</span></div>
{% endif %}
</div>
</div>
{% if pagination.totalItemCount > 0 %}
<div class="ec-shelfRole">
<ul class="p-products-list">
{% for Product in pagination %}
{% set CatId = '' %}
{% set CatMaker = '' %}{# メーカー #}
{% set CatSeriesId = '' %}{# シリーズID #}
{% set CatShape = '' %}{# 形状 #}
{% set CatPower = '' %}{# 馬力 #}
{% set TagPower1 = '' %}{# 電源1 #}
{% set TagPower2 = '' %}{# 電源2 #}
{% set ProductCode = '' %}{# 型番 #}
{% set HiddenFlag = '0' %}{# 非表示フラグ #}
{# カテゴリ #}
{% if Product.ProductCategories is not empty %}
{% for ProductCategory in Product.ProductCategories %}
{% if ProductCategory.Category.getParent is not null %}
{% if ProductCategory.Category.getParent.id == 1 %}
{% set CatMaker = ProductCategory.Category.name %}{# メーカー #}
{% set CatId = ProductCategory.Category.id %}
{% endif %}
{% if ProductCategory.Category.getParent.id == 51 %}
{% set CatShape = ProductCategory.Category.id %}{# 形状 #}
{% endif %}
{% if ProductCategory.Category.getParent.id == 61 %}
{% set CatPower = ProductCategory.Category.id %}{# 馬力 #}
{% endif %}
{% endif %}
{% if CatId is not empty %}
{% if ProductCategory.Category.getParent is not null %}
{% if ProductCategory.Category.getParent.id == CatId %}
{% set CatSeriesId = ProductCategory.Category.id %}{# シリーズID #}
{% set Category = repository('Eccube\\Entity\\Category').find(CatSeriesId) %}
{% set HiddenFlag = Category.hidden_flag %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{# タグ:電源 #}
{% if Product.hasTag(1) %}
{% set PageTag = repository('Eccube\\Entity\\Tag').find('1') %}
{% set TagPower1 = PageTag.name %}{# 電源1 #}
{% endif %}
{% if Product.hasTag(2) %}
{% set PageTag = repository('Eccube\\Entity\\Tag').find('2') %}
{% set TagPower2 = PageTag.name %}{# 電源2 #}
{% endif %}
{# 型番 #}
{% if Product.code_min is not empty %}
{% set ProductCode = Product.code_min %}{# 型番 #}
{% endif %}
<li class="p-products-item">
<figure class="s-image">
{# <a href="{{ url('product_detail', {'id': Product.id}) }}?shape={{ CatShape }}&power={{ CatPower }}"> #}
<a href="{{ url('product_detail', {'id': Product.id}) }}">
<img src="{{ asset(Product.main_list_image|no_image_product, 'save_image') }}" alt="{{ Product.name }}" {% if loop.index > 5 %} loading="lazy"{% endif %}>
</a>
</figure>
<div class="s-content">
{# <h4 class="s-title"><a href="{{ url('product_detail', {'id': Product.id}) }}?shape={{ CatShape }}&power={{ CatPower }}">{{ CatMaker }} {{ Product.name }}</a></h4> #}
<h4 class="s-title"><a href="{{ url('product_detail', {'id': Product.id}) }}">{{ CatMaker }} {{ Product.name }}</a></h4>
<table class="c-table-04">
<tr>
<th class="s-col1">型番</th>
<th class="s-col2">定価(税込)</th>
<th class="s-col3">販売価格(税込)</th>
</tr>
<tr>
<td>
{{ ProductCode }}
</td>
<td>
<p class="p-products-text01"><span class="s-main font-en">
{{ Product.getPrice01IncTaxMin|number_format }}
</span>円</p>
</td>
<td>
<div class="p-products-list-price02-wrap">
{% set price01 = Product.getPrice01IncTaxMin %}
{% set price02 = Product.getPrice02IncTaxMin %}
{% if price01 != '' %}
<p class="p-products-label01"><span class="font-en">
<span class="s-main">
{% set price03 = (1-(price02 / price01))*100|round(1, 'ceil') %}
{{ price03|number_format(1, '.', ',') }}
</span>%</span><br class="no-pc">割引</p>
{% endif %}
<p class="p-products-text02"><span class="s-main font-en">
{{ Product.getPrice02IncTaxMin|number_format }}
</span>円</p>
</div>
</td>
</tr>
</table>
</div>
</li>
{% endfor %}
</ul>
</div>
<div class="ec-pagerRole">
{% include "pager.twig" with {'pages': pagination.paginationData} %}
</div>
{% endif %}
{% endif %}
</div>
{% endblock %}