{#
* This file is part of the Recommend Product plugin
*
* Copyright (C) EC-CUBE CO.,LTD. All Rights Reserved.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
#}
{# 親テンプレートにスライダーが実装されていれば読み込まない #}
{% set include_slide_js = include_slide_js is not defined or include_slide_js %}
{% block stylesheet %}
{% if include_slide_js %}
<link rel="stylesheet" href="{{ asset('assets/css/splide.min.css') }}">
<link rel="stylesheet" href="{{ asset('assets/css/slide.css') }}">
{% endif %}
{% endblock %}
{% block javascript %}
{% if include_slide_js %}
<script src="{{ asset('assets/js/vendor/splide.min.js') }}"></script>
<script src="{{ asset('assets/js/slide.js') }}"></script>
{% endif %}
{% endblock %}
{% set recommend_products = repository('Plugin\\Recommend42\\Entity\\RecommendProduct').getRecommendProduct %}
{% if recommend_products is not empty %}
{% if recommend_product is same as (true) %}
<!-- ▼item_list▼ -->
<article class="m-article width-full">
<div id="recently-viewed_splide" class="m-article_inner splide" aria-labelledby="recently-viewd_carousel-heading">
<header id="recently-viewd_carousel-heading" class="m-header h-2 space-wide">
<h2 class="title">おすすめ商品</h2>
</header>
<section class="carousel splide__track">
<ul class="carousel_list splide__list">
{% for RecommendProduct in recommend_products %}
<li class="carousel_list_item splide__slide">
<section class="m-product_label">
{% if is_granted('ROLE_USER') %}
{% if customer is not defined %}
{% if repository('Eccube\\Entity\\CustomerFavoriteProduct').isFavorite(Customer, RecommendProduct.Product) %}
<button class="label-favorite active favorite_product" data-customer="{{ Customer.id }}" data-product="{{ RecommendProduct.Product.id }}"></button>
{% else %}
<button class="label-favorite favorite_product" data-customer="{{ Customer.id }}" data-product="{{ RecommendProduct.Product.id }}"></button>
{% endif %}
{% else %}
{% if repository('Eccube\\Entity\\CustomerFavoriteProduct').isFavorite(customer, RecommendProduct.Product) %}
<button class="label-favorite active favorite_product" data-customer="{{ customer.id }}" data-product="{{ RecommendProduct.Product.id }}"></button>
{% else %}
<button class="label-favorite favorite_product" data-customer="{{ customer.id }}" data-product="{{ RecommendProduct.Product.id }}"></button>
{% endif %}
{% endif %}
{% else %}
<button class="modal-favorite label-favorite" data-product="{{ RecommendProduct.Product.id }}"></button>
{% endif %}
</section>
{% if RecommendProduct.Product.ProductClasses.0.NormalProduct is not null %}
<section class="m-product_label">
<p class="label-subscription">定期購入</p>
</section>
<a href="{{ path('product_detail', {'id': RecommendProduct.Product.id}) }}">
<p class="carousel_list_item_image">
<img src="{{ asset(RecommendProduct.Product.ProductClasses.0.NormalProduct.mainFileName|no_image_product, "save_image") }}"
alt="{{ RecommendProduct.Product.getName }}">
{% else %}
<a href="{{ path('product_detail', {'id': RecommendProduct.Product.id}) }}">
<p class="carousel_list_item_image">
<img src="{{ asset(RecommendProduct.Product.mainFileName|no_image_product, "save_image") }}"
alt="{{ RecommendProduct.Product.getName }}">
{% endif %}
</p>
{% if RecommendProduct.Product.getProductCategories is not empty %}
<p class="carousel_list_item_category">{{ RecommendProduct.Product.getProductCategories.0.getCategory.getName }}</p>
{% endif %}
<p class="carousel_list_item_name">{{ RecommendProduct.Product.getName }}</p>
<p class="carousel_list_item_price">
{% if RecommendProduct.Product.hasProductClass %}
{% if RecommendProduct.Product.getPrice02Min == RecommendProduct.Product.getPrice02Max %}
{{ RecommendProduct.Product.getPrice02IncTaxMin|price }}
<span>税込</span>
{% else %}
{{ RecommendProduct.Product.getPrice02IncTaxMin|price }} ~ {{ RecommendProduct.Product.getPrice02IncTaxMax|price }}
<span>税込</span>
{% endif %}
{% else %}
{{ RecommendProduct.Product.getPrice02IncTaxMin|price }}<span>税込</span>
{% endif %}
</p>
</a>
{% set avg = repository('Plugin\\ProductReview42Plus\\Entity\\ProductReview').getOpenAvgAll(RecommendProduct.Product) %}
<a href="{{ path('mypage_history', {'order_no': RecommendProduct.id}) }}">
<section class="m-rating small">
<div class="m-rating_label"
data-score="{{ avg['recommend_avg']|round(1)|default(0) }}"></div>
<span>({{ avg['review_count']|default(0) }})</span>
</section>
</a>
</p>
</a>
</li>
{% endfor %}
</ul>
</section>
<section class="carousel_arrows bottom">
<section class="splide__arrows splide__arrows--ltr">
<button class="splide__arrow splide__arrow--prev" type="button" aria-label="Previous slide" aria-controls="splide01-track">
<img src="{{ asset('assets/img/customize/icon_arrow.svg') }}" alt="prev" width="6" height="12"/>
</button>
<button class="splide__arrow splide__arrow--next " type="button" aria-label="Next slide" aria-controls="splide01-track">
<img src="{{ asset('assets/img/customize/icon_arrow.svg') }}" alt="next" width="6" height="12"/>
</button>
</section>
</section>
</div>
</article>
{% endif %}
{% endif %}
{% if productHistory is defined and productHistory is not empty %}
{% if recently_viewd is same as (true) %}
<article class="m-article width-full">
<div id="recently-viewed_splide" class="m-article_inner splide" aria-labelledby="recently-viewd_carousel-heading">
<header id="recently-viewd_carousel-heading" class="m-header h-2 space-wide">
{% if recently_viewd_title is same as (false) %}
<h2 class="content_header_title">
RECENTLY VIEWED
<span>最近見た商品</span>
</h2>
{% else %}
<h2 class="title">最近見た商品</h2>
{% endif %}
</header>
<section class="carousel splide__track">
<ul class="carousel_list splide__list">
{% for ph in productHistory %}
{% if ph.ProductClasses.0.NormalProduct is null %}
<li class="carousel_list_item splide__slide">
<section class="m-product_label">
{% if is_granted('ROLE_USER') %}
{% if customer is not defined %}
{% if repository('Eccube\\Entity\\CustomerFavoriteProduct').isFavorite(Customer, ph) %}
<button class="label-favorite active favorite_product" data-customer="{{ Customer.id }}" data-product="{{ ph.id }}"></button>
{% else %}
<button class="label-favorite favorite_product" data-customer="{{ Customer.id }}" data-product="{{ ph.id }}"></button>
{% endif %}
{% else %}
{% if repository('Eccube\\Entity\\CustomerFavoriteProduct').isFavorite(customer, ph) %}
<button class="label-favorite active favorite_product" data-customer="{{ customer.id }}" data-product="{{ ph.id }}"></button>
{% else %}
<button class="label-favorite favorite_product" data-customer="{{ customer.id }}" data-product="{{ ph.id }}"></button>
{% endif %}
{% endif %}
{% else %}
<button class="modal-favorite label-favorite" data-product="{{ ph.id }}"></button>
{% endif %}
</section>
{% if ph.ProductClasses.0.NormalProduct is not null %}
<section class="m-product_label">
<p class="label-subscription">定期購入</p>
</section>
<a href="{{ path('product_detail', {'id': ph.id}) }}">
<p class="carousel_list_item_image">
<img src="{{ asset(ph.ProductClasses.0.NormalProduct.mainFileName|no_image_product, "save_image") }}" alt="{{ ph.getName }}">
{% else %}
<a href="{{ path('product_detail', {'id': ph.id}) }}">
<p class="carousel_list_item_image">
<img src="{{ asset(ph.mainFileName|no_image_product, "save_image") }}" alt="{{ ph.getName }}">
{% endif %}
</p>
{% if ph.getProductCategories is not empty %}
<p class="carousel_list_item_category">{{ ph.getProductCategories.0.getCategory.getName }}</p>
{% endif %}
<p class="carousel_list_item_name">{{ ph.getName }}</p>
<p class="carousel_list_item_price">
{% if ph.hasProductClass %}
{% if ph.getPrice02Min == ph.getPrice02Max %}
{{ ph.getPrice02IncTaxMin|price }}<span>税込</span>
{% else %}
{{ ph.getPrice02IncTaxMin|price }} ~ {{ ph.getPrice02IncTaxMax|price }}<span>税込</span>
{% endif %}
{% else %}
{{ ph.getPrice02IncTaxMin|price }}<span>税込</span>
{% endif %}
</p>
</a>
{% set avg_ph = repository('Plugin\\ProductReview42Plus\\Entity\\ProductReview').getOpenAvgAll(ph) %}
<a href={{ path('mypage_history', {'order_no': ph.id}) }}>
<section class="m-rating small">
<div class="m-rating_label" data-score="{{ avg_ph['recommend_avg']|round(1)|default(0) }}"></div>
<span>({{ avg_ph['review_count']|default(0) }})</span>
</section>
</a>
</li>
{% endif %}
{% endfor %}
</ul>
</section>
<section class="carousel_arrows bottom">
<section class="splide__arrows splide__arrows--ltr">
<button class="splide__arrow splide__arrow--prev" type="button" aria-label="Previous slide" aria-controls="splide01-track">
<img src="{{ asset('assets/img/customize/icon_arrow.svg') }}" alt="prev" width="6" height="12"/>
</button>
<button class="splide__arrow splide__arrow--next " type="button" aria-label="Next slide" aria-controls="splide01-track">
<img src="{{ asset('assets/img/customize/icon_arrow.svg') }}" alt="next" width="6" height="12"/>
</button>
</section>
</section>
</div>
</article>
{% endif %}
{% endif %}
<!-- ▲item_list▲ -->