{#
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();
});
$('.disp-number-artist').change(function () {
var dispNumber = $(this).val();
var currentUrl = window.location.href;
if (currentUrl.indexOf('disp_number=') !== -1) {
currentUrl = currentUrl.replace(/(disp_number=)[^&]*/, '$1' + dispNumber);
} else {
currentUrl += (currentUrl.indexOf('?') === -1 ? '?' : '&') + 'disp_number=' + dispNumber;
}
window.location.href = currentUrl;
});
$('.order-by-artist').change(function () {
var orderBy = $(this).val();
var currentUrl = window.location.href;
if (currentUrl.indexOf('order_by=') !== -1) {
currentUrl = currentUrl.replace(/(order_by=)[^&]*/, '$1' + orderBy);
} else {
currentUrl += (currentUrl.indexOf('?') === -1 ? '?' : '&') + 'order_by=' + orderBy;
}
window.location.href = currentUrl;
});
$('.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();
});
$(document).ready(function() {
$('.custom-select').select2({
minimumResultsForSearch: -1,
dropdownCssClass: 'select2-dropdown-slide'
});
});
});
</script>
{% endblock %}
{% block main %}
<div class="ec-layoutRole__main custom-layout__product">
{# breadcumb #}
{% if GroupProduct is defined and GroupProduct %}
{% if GroupProduct.ProductCategories is not empty %}
<div class="ec-breadcrumbs_layout">
{% set shown_breadcrumb = false %}
{% for ProductCategory in GroupProduct.ProductCategories %}
{% if not shown_breadcrumb and (GroupProduct.ProductCategories|length == 1 or ProductCategory.Category.path|length >= 2) %}
<div class="ec-breadcrumbs">
<a href="/">Home</a>
<span> ></span>
{% for Category in ProductCategory.Category.path %}
{% if Category.id == 1 %}
<a href="/rock/">{{ Category.name }}</a>
{% else %}
<a href="{{ url('product_list') }}?category_id={{ Category.id }}">{{ Category.name }}</a>
{% endif %}
{%- if loop.last == false %}
<span> ></span>
{% endif -%}
{% endfor %}
<span> ></span> {{ GroupProduct.name }}
</div>
{% set shown_breadcrumb = true %}
{% endif %}
{% endfor %}
</div>
{% endif %}
{% else %}
<div class="ec-breadcrumbs">
<div itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb">
<a href="/" itemprop="url">
<span itemprop="title">Home</span>
</a>
</div>
{% if Artist is defined and Artist %}
<div>
>
<a href="{{ Artist.getCategoryLabelUrl() }}" itemprop="url">
<span itemprop="title">{{Artist.CategoryLabel.name}}</span>
</a>
</div>
<div>
>
<span itemprop="title">{{Artist.name}}</span>
</div>
{% elseif Category is defined and Category %}
{% if Category.Parent %}
<div>
>
<a href="{{ url('product_list') }}?category_id={{ Category.Parent.id }}" itemprop="url">
<span itemprop="title">{{Category.Parent.name}}</span>
</a>
</div>
{% endif %}
<div>
>
<span itemprop="title">{{Category.name}}</span>
</div>
{% else %}
<div>
>
<span itemprop="title">全商品</span>
</div>
{% endif %}
</div>
{% endif %}
{# end breadcumb #}
{% 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">
<div class="ec-searchnavRole__search">
<form name="form1" id="form1" method="get" action="?">
{% for item in search_form %}
{% if item.vars.id not in ['name', 'field_type', 'genre_id'] %}
<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 %}
<input type="hidden" name="pageno" value="1">
<div class="d-flex align-items-center gap-1">
<div class="d-flex align-items-center p-0">
<div class="ec-searchnavRole__search__input input-name">
{{ form_widget(search_form.name) }}
<button class="ec-headerSearch__keywordBtn" type="submit">
<img src="{{ asset('assets/icon/btn_search_s.jpg') }}" alt="購入履歴">
</button>
</div>
{{ form_errors(search_form.name) }}
</div>
<div class="">
<div class="ec-searchnavRole__search__input input-select">
{{ form_widget(search_form.field_type, {'attr': {'class': 'custom-select'}}) }}
<button class="ec-headerSearch__keywordBtn" type="submit">
<img src="{{ asset('assets/icon/btn_topsearch_music_genre.png') }}" alt="購入履歴">
</button>
</div>
{{ form_errors(search_form.field_type) }}
</div>
<div class="">
<div class="ec-searchnavRole__search__input input-select">
{{ form_widget(search_form.genre_id, {'attr': {'class': 'custom-select'}}) }}
<button class="ec-headerSearch__keywordBtn" type="submit">
<img src="{{ asset('assets/icon/btn_topsearch_item_genre.png') }}" alt="購入履歴">
</button>
</div>
{{ form_errors(search_form.genre_id) }}
</div>
<div class="">
<button class="search-button" type="submit">
<img src="{{ asset('assets/icon/btn_search.jpg') }}" alt="{{ '検索'|trans }}">
</button>
</div>
</div>
</form>
</div>
{# artist detail #}
{% if Artist is defined and Artist %}
<div class="artist">
{% if ArtistImage is defined and ArtistImage %}
<div class="artist-image">
<img src="{{ ArtistImage }}" class="artist-image" alt="{{ Artist.name }}">
</div>
{% endif %}
<div class="artist-detail">
<p>{{ Artist.category_content|raw|nl2br }}</p>
</div>
</div>
{% endif %}
{# end artist detail #}
<div class="ec-searchnavRole__infos">
<div class="ec-searchnavRole__counter">
{% if pagination.totalItemCount > 0 %}
{{ '<span class="attention">%count%件</span><span>の商品がございます。</span>'|trans({ '%count%': pagination.totalItemCount })|raw }}
{% else %}
<span>{{ 'お探しの商品は見つかりませんでした'|trans }}</span>
{% endif %}
</div>
<div class="ec-searchnavRole__actions">
{% if Artist is defined and Artist %}
<div class="ec-select">
{{ form_widget(search_form.orderby, {'id': '', 'attr': {'class': 'order-by-artist'}}) }}
{{ form_widget(search_form.disp_number, {'id': '', 'attr': {'class': 'disp-number-artist'}}) }}
</div>
{% else %}
<div class="ec-select">
{{ form_widget(search_form.orderby, {'id': '', 'attr': {'class': 'order-by'}}) }}
{{ form_widget(search_form.disp_number, {'id': '', 'attr': {'class': 'disp-number'}}) }}
</div>
{% endif %}
</div>
</div>
</div>
{% if pagination.totalItemCount > 0 %}
<div class="ec-shelfRole">
<div class="ec-counterRole">
{% if pagination.totalItemCount > 0 %}
{{ '<span class="attention">%count%件</span><span>の商品がございます。</span>'|trans({ '%count%': pagination.totalItemCount })|raw }}
{% else %}
<span>{{ 'お探しの商品は見つかりませんでした'|trans }}</span>
{% endif %}
</div>
<ul class="ec-shelfGrid">
{% for Product in pagination %}
<li class="ec-shelfGrid__item">
<a class="link-product" href="{{ url('product_detail', {id: Product.id}) }}">
<p class="ec-shelfGrid__item-image">
{% set isSoldOut = true %}
{% for productClass in Product.ProductClasses %}
{% if productClass.stock_find %}
{% set isSoldOut = false %}
{% endif %}
{% endfor %}
{% if isSoldOut %}
<span class="soldout_box"></span>
<span class="soldout">SOLD OUT</span>
{% endif %}
<img src="{{ asset(Product.main_list_image|no_image_product, 'save_image') }}" alt="{{ Product.name }}" {% if loop.index > 5 %} loading="lazy" {% endif %}>
</p>
{% if Product.ProductStatusCusts|length > 0 %}
<ul class="ec-productRole__status">
{% set statusIds = [1, 2, 4, 5] %}
{% set statusIdsSpicon = [6, 13, 14] %}
{% for StatusItem in Product.ProductStatusCusts %}
{% if StatusItem.Status.id == 3 %}
<li class="ward-status">
<span class="ec-productRole__status__item status_3">
<img src="{{ asset('assets/img/common/ico_wgen.jpg') }}" alt="ico_wgen">
</span>
</li>
{% endif %}
{% endfor %}
{% for StatusItem in Product.ProductStatusCusts %}
{% if StatusItem.Status.id != 3 %}
{% set showSpicon = 0 %}
{% if StatusItem.Status.id in statusIds %}
<li class="ec-productRole__status__item status_{{ StatusItem.Status.id }}">
<span>{{ StatusItem.Status.name }}</span>
</li>
{% endif %}
{% if StatusItem.Status.id == 11 %}
<li class="ec-productRole__status__item status_{{ StatusItem.Status.id }}">
<span>お年玉セール</span>
</li>
{% endif %}
{% if StatusItem.Status.id in statusIdsSpicon %}
{% set showSpicon = StatusItem.Status.id %}
{% endif %}
{% if showSpicon == 6 %}
<li class="ec-productRole__status__item status_12">
<span>直筆サイン付</span>
</li>
{% endif %}
{% endif %}
{% endfor %}
</ul>
{% endif %}
{% if Product.getFirstArtist() is not null %}
<p class="ec-shelfGrid__item-artist">
{{ Product.getFirstArtist().name }}
</p>
{% endif %}
<p class="ec-shelfGrid__item-name">
{{ Product.papc3 }}
{{ Product.name }}
{{ Product.papc4 }}
</p>
<p class="price02-default">
{# {% if productClass.sale_type01 == 0 %} #}
{% if Product.hasProductClass %}
{% if Product.getPrice02Min == Product.getPrice02Max %}
<span class="ec-price__price price02-default">
{{ Product.getPrice02IncTaxMin | number_format(0, '.', ',') }}円
</span>
<span class="ec-price__price price02-default tax-excluded-price">
(税抜 {{ Product.getPrice02Min | number_format(0, '.', ',') }}円)
</span>
<span class="ec-price__price price02-default tax-excluded-price1">
(税込)
</span>
{% else %}
<div class="ec-price">
<span class="ec-price__price price02-default">
{{ Product.getPrice02IncTaxMin | number_format(0, '.', ',') }} ~
{{ Product.getPrice02IncTaxMax | number_format(0, '.', ',') }}円
</span>
<span class="ec-price__price price02-default tax-excluded-price">
(税抜 {{ Product.getPrice02Min | number_format(0, '.', ',') }} ~
{{ Product.getPrice02Max | number_format(0, '.', ',') }}円)
</span>
<span class="ec-price__price price02-default tax-excluded-price1">
(税込)
</span>
</div>
{% endif %}
{% else %}
<div class="ec-price">
<span class="ec-price__price">
{{ Product.getPrice02IncTaxMin | number_format(0, '.', ',') }}円
</span>
<span class="ec-price__price tax-excluded-price">
(税抜 {{ Product.getPrice02Min | number_format(0, '.', ',') }}円)
</span>
<span class="ec-price__price price02-default tax-excluded-price1">
(税込)
</span>
</div>
{% endif %}
{# {% else %}
{% if Product.hasProductClass %}
{% set sale_price = Product.ProductClasses.first().sale_price + 0 %}
{% if Product.getPrice02Min == Product.getPrice02Max %}
<span class="ec-price__price price02-default">
{{ (sale_price * 1.1) | number_format(0, '.', ',') }}円
</span>
<span class="ec-price__price price02-default tax-excluded-price">
(税抜 {{ sale_price | number_format(0, '.', ',') }}円)
</span>
<span class="ec-price__price price02-default tax-excluded-price1">
(税込)
</span>
{% else %}
{% set sale_price = Product.ProductClasses.first().sale_price + 0 %}
<div class="ec-price">
<span class="ec-price__price price02-default">
{{ sale_price | number_format(0, '.', ',') }} ~
{{ (sale_price * 1.1) | number_format(0, '.', ',') }}円
</span>
<span class="ec-price__price price02-default tax-excluded-price">
(税抜 {{ (sale_price * 1.1) | number_format(0, '.', ',') }} ~
{{ sale_price | number_format(0, '.', ',') }}円)
</span>
<span class="ec-price__price price02-default tax-excluded-price1">
(税込)
</span>
</div>
{% endif %}
{% else %}
{% set sale_price = Product.ProductClasses.first().sale_price + 0 %}
<div class="ec-price">
<span class="ec-price__price">
{{ (sale_price * 1.1) | number_format(0, '.', ',') }}円
</span>
<span class="ec-price__price tax-excluded-price">
(税抜 {{ sale_price | number_format(0, '.', ',') }}円)
</span>
<span class="ec-price__price price02-default tax-excluded-price1">
(税込)
</span>
</div>
{% endif %}
{% endif %} #}
</p>
{% set original_price = Product.getPrice01IncTaxMin %}
{% set sale_price = Product.getPrice02IncTaxMin %}
{% if original_price > 0 and sale_price is not null and original_price > sale_price %}
<div class="sale_price">
{% set discount_percentage = ((original_price - sale_price) / original_price * 100)|round(2) %}
<span class="plgShiro8PriceDownRate">
{{ (discount_percentage // 1) }}%OFF
</span>
</div>
{% endif %}
</a>
</li>
{% endfor %}
</ul>
<div class="ec-pagerRole">
{% include "pager.twig" with {'pages': pagination.paginationData} %}
</div>
</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 %}
{% endif %}
</div>
{% endblock %}