{#
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 orderbySubmit (orderId) {
$('#orderby').val(orderId);
$('#pageno').val(1);
$("#form1").submit();
}
$(document).mouseup(function(e)
{
var container = $(".orderbyLabel");
// if the target of the click isn't the container nor a descendant of the container
if (!container.is(e.target) && container.has(e.target).length === 0)
{
$('.dropdownOrderbyList').css('visibility', 'hidden');
}
});
$(function() {
var url_string = location.href;
var url = new URL(url_string);
var product_name = url.searchParams.get("name");
var details_title = "商品一覧";
if (product_name)
details_title = product_name + "の商品一覧";
details_title = `<span>${details_title}</span>`
$('#list_name').html(details_title);
if (url.href.indexOf('orderby') < 0) {
$('.order-by > div:first-child input').prop('checked', true);
$('.orderbyLabel').text('並び替え');
$('.dropdownOrderbyList > li:first-child').addClass('active');
} else {
var orderid = url.searchParams.get("orderby");
// pc
$(`.order-by input#orderby_${orderid}`).prop('checked', true);
// sp
$(`.dropdownOrderbyList__item#orderby__${orderid}`).addClass('active');
var orderLabel = $(`.dropdownOrderbyList__item#orderby__${orderid}`).text();
$('.orderbyLabel').text(orderLabel);
}
// sp 並び順を変更
$('.orderbyLabel').on('click', function (e) {
e.preventDefault();
const element = document.querySelector('.dropdownOrderbyList');
const visibility = element.style.visibility;
if (visibility == 'visible') {
$('.dropdownOrderbyList').css('visibility', 'hidden');
} else {
$('.dropdownOrderbyList').css('visibility', 'visible');
}
});
// 並び順を変更
$('.order-by input[name="orderby"]').change(function() {
var orderBy = $(this).val();
$('#orderby').val(orderBy);
$('#pageno').val(1);
$("#form1").submit();
});
});
$('.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="ec-searchnavRole">
<div class="ec-searchnavRole__topicpath">
<ol class="ec-topicpath">
<li class="ec-topicpath__item">
<span>{{ 'おすすめ商品一覧' }}</span>
</li>
</ol>
</div>
</div>
<div class="ec-blockspliter"></div>
<div class="ec-searchnavRole ec-searchnavRole-height ec-productListSPSearchNav">
<form name="form1" id="form1" method="get" action="?">
<input type="hidden" id="orderby" name="orderby" />
</form>
<div class="ec-searchnavRole__infospace show-resultPC">
<span>{{ '並び替え'|trans }}</span>
</div>
<div class="ec-searchnavRole__infos ec-spOrderby show-resultSP">
<div class="orderbyLabel"></div>
<ul class="dropdownOrderbyList">
{% for orderitem in OrderList %}
<li class="dropdownOrderbyList__item" id="orderby__{{ orderitem.id }}" onclick="orderbySubmit({{ orderitem.id }})">{{ orderitem.name }}</li>
{% endfor %}
</ul>
</div>
<div class="ec-searchnavRole__infos show-resultPC">
<div class="order-by">
{% for orderitem in OrderList %}
<div class="form-check">
<input type="radio" id="orderby_{{ orderitem.id }}" name="orderby" required="required" class="form-check-input" value="{{ orderitem.id }}">
<label class="form-check-label required" for="orderby_{{ orderitem.id }}">{{ orderitem.name }}</label>
</div>
{% endfor %}
</div>
</div>
</div>
<div class="ec-blockspliter"></div>
{% if pagination|length > 0 %}
<div class="ec-role">
<div class="ec-newItemRole">
<div class="ec-newItemRole__list">
{% for key, RecommendProduct in pagination %}
<div class="ec-newItemRole__listItem">
<a href="{{ url('product_detail', {'id': RecommendProduct.Product.id}) }}">
<figure>
<img src="{{ asset(RecommendProduct.Product.mainFileName|no_image_product, 'save_image') }}"
alt="{{ RecommendProduct.Product.name }}" {% if loop.index > 5 %} loading="lazy"{% endif %}>
</figure>
<span class="newitembadge" style="background-color: unset;"></span>
<div>
<p class="ec-newItemRole__listItemTitle">{{ RecommendProduct.Product.name|trans }}</p>
<p class="ec-newItemRole__listItemPrice">
{% if RecommendProduct.Product.hasProductClass %}
{% if RecommendProduct.Product.getPrice02Min == RecommendProduct.Product.getPrice02Max %}
{{ RecommendProduct.Product.getPrice02IncTaxMin|price }}
{% else %}
{{ RecommendProduct.Product.getPrice02IncTaxMin|price }} ~ {{ RecommendProduct.Product.getPrice02IncTaxMax|price }}
{% endif %}
{% else %}
{{ RecommendProduct.Product.getPrice02IncTaxMin|price }}
{% endif %}{{ '(税込)'|trans }}
</p>
</div>
</a>
</div>
{% endfor %}
</div>
</div>
{# {% if pagination|length > 1 %}#}
{# <div class="ec-blockspliter"></div>#}
{# {% endif %}#}
</div>
{# {% if pagination|length > 1 %}#}
{# <div class="ec-role">#}
{# <div class="ec-pagerRole ec-newsPagination">#}
{# {% include "pager.twig" with {'pages': pagination.paginationData} %}#}
{# </div>#}
{# </div>#}
{# {% endif %}#}
<div class="ec-blockspliter productListSpliter"></div>
<div class="ec-blockempty"></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>
{% endif %}
{% endblock %}