{#
* 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 recommend_products = repository('Plugin\\Recommend4\\Entity\\RecommendProduct').getRecommendProduct %}
<!-- ▼item_list▼ -->
<div class="category_list__recommendation">
<div class="page__inner">
<h2 class="mod_movie-h2">{{ 'あなたにおすすめの動画'|trans }}</h2>
{#<p class="mod_movie-lead">{{ '毎日更新♪ みんなで脳トレ!!麻雀で繋がろう '|trans }}</p>#}
<ul class="mod_movie-list">
{% for RecommendProduct in recommend_products %}
{% set isFavorite = false %}
{% if is_granted('ROLE_USER') %}
{% set isFavorite = app.user is not empty and repository('Eccube\\Entity\\CustomerFavoriteProduct').isFavorite(app.user, RecommendProduct.Product) %}
{% endif %}
{% set Product = RecommendProduct.Product %}
{% set productClass = Product.ProductClasses.get(0) %}
{% set videoContent = productClass.ProductClassContent.get(0) %}
{% if videoContent is not empty %}
{% set anker = url('video/{product_id}/content/{content_id}', {'product_id': Product.id, 'content_id': videoContent.Content.id}) %}
{% else %}
{% set anker = url('product_detail', {'id': Product.id}) %}
{% endif %}
<li class="mod_movie-item">
<div class="mod_movie-item-inner">
<div class="mod_movie-img-wrapper">
<a href="{{ anker }}"><img src="{{ asset(Product.mainFileName|no_image_product, "save_image") }}"></a>
</div>
<div class="mod_movie-text-wrapper">
<a href="{{ anker }}" class="mod_movie-title">{{ Product.name|trans }}</a>
<ul class="mod_movie-keyword-list">
{% set searchWords = Product.search_word|split(',') %}
{% for word in searchWords %}
{% if word is not empty %}
<li class="mod_movie-keyword-item">
<span>{{ word|trans }}</span>
</li>
{% endif %}
{% endfor %}
</ul>
<div class="mod_movie-btn-wrapper">
<div class="mod_movie-btn-favorite {{ (isFavorite == 1) ? 'favorite__del': 'favorite__add' }}" data-pid="{{ Product.id }}">
{#<input type="submit" value="見たい授業" />#}
{% if isFavorite == 1 %}
<input type="button" class="favorite-btn" value="{{ '見たい授業'|trans }}" />
{% else %}
<input type="button" class="favorite-btn" value="{{ '見たい授業'|trans }}" />
{% endif %}
</div>
<a href="{{ anker }}" class="mod_movie-btn-watch"><span>{{ '見る'|trans }}</span></a>
</div>
</div>
</div>
</li>
{% endfor %}
</ul>
<div class="mod_movie-btn-more">
<a href="{{ url('product_list') }}">{{ '動画をもっと見る'|trans }}</a>
</div>
</div>
</div>