app/template/default/Block/recommend_product_block.twig line 1

Open in your IDE?
  1. {#
  2.  * This file is part of the Recommend Product plugin
  3.  *
  4.  * Copyright (C) EC-CUBE CO.,LTD. All Rights Reserved.
  5.  *
  6.  * For the full copyright and license information, please view the LICENSE
  7.  * file that was distributed with this source code.
  8. #}
  9. {% set recommend_products = repository('Plugin\\Recommend4\\Entity\\RecommendProduct').getRecommendProduct %}
  10. <!-- ▼item_list▼ -->
  11. <div class="category_list__recommendation">
  12.   <div class="page__inner">
  13.     <h2 class="mod_movie-h2">{{ 'あなたにおすすめの動画'|trans }}</h2>
  14.     {#<p class="mod_movie-lead">{{ '毎日更新♪ みんなで脳トレ!!麻雀で繋がろう '|trans }}</p>#}
  15.     <ul class="mod_movie-list">
  16.       {% for RecommendProduct in recommend_products %}
  17.       {% set isFavorite = false %}
  18.       {% if is_granted('ROLE_USER') %}
  19.         {% set isFavorite = app.user is not empty and repository('Eccube\\Entity\\CustomerFavoriteProduct').isFavorite(app.user, RecommendProduct.Product) %}
  20.       {% endif %}
  21.       {% set Product = RecommendProduct.Product %}
  22.       {% set productClass = Product.ProductClasses.get(0) %}
  23.       {% set videoContent = productClass.ProductClassContent.get(0) %}
  24.       {% if videoContent is not empty %}
  25.         {% set anker = url('video/{product_id}/content/{content_id}', {'product_id': Product.id, 'content_id': videoContent.Content.id}) %}
  26.       {% else %}
  27.         {% set anker = url('product_detail', {'id': Product.id}) %}
  28.       {% endif %}
  29.       <li class="mod_movie-item">
  30.         <div class="mod_movie-item-inner">
  31.           <div class="mod_movie-img-wrapper">
  32.             <a href="{{ anker }}"><img src="{{ asset(Product.mainFileName|no_image_product, "save_image") }}"></a>
  33.           </div>
  34.           <div class="mod_movie-text-wrapper">
  35.             <a href="{{ anker }}" class="mod_movie-title">{{ Product.name|trans }}</a>
  36.             <ul class="mod_movie-keyword-list">
  37.               {% set searchWords = Product.search_word|split(',') %}
  38.               {% for word in searchWords %}
  39.                 {% if word is not empty %}
  40.                 <li class="mod_movie-keyword-item">
  41.                   <span>{{ word|trans }}</span>
  42.                 </li>
  43.                 {% endif %}
  44.               {% endfor %}
  45.             </ul>
  46.             <div class="mod_movie-btn-wrapper">
  47.               <div class="mod_movie-btn-favorite {{ (isFavorite == 1) ? 'favorite__del': 'favorite__add' }}" data-pid="{{ Product.id }}">
  48.                    
  49.                 {#<input type="submit" value="見たい授業" />#}
  50.                 {% if isFavorite == 1 %}
  51.                     <input type="button" class="favorite-btn" value="{{ '見たい授業'|trans }}" />
  52.                 {% else %}
  53.                     <input type="button" class="favorite-btn" value="{{ '見たい授業'|trans }}" />
  54.                 {% endif %}
  55.               </div>
  56.               <a href="{{ anker }}" class="mod_movie-btn-watch"><span>{{ '見る'|trans }}</span></a>
  57.             </div>
  58.           </div>
  59.         </div>
  60.       </li>
  61.       {% endfor %}
  62.     </ul>
  63.     <div class="mod_movie-btn-more">
  64.       <a href="{{ url('product_list') }}">{{ '動画をもっと見る'|trans }}</a>
  65.     </div>
  66.   </div>
  67. </div>