app/template/cosme41/ProductReview42/Resource/template/default/review.twig line 1

Open in your IDE?
  1. {#
  2. /*
  3.  * This file is part of the ProductReview plugin
  4.  *
  5.  * Copyright (C) 2016 LOCKON CO.,LTD. All Rights Reserved.
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. #}
  11. {% import _self as stars %}
  12. {# 星テキスト生成用マクロ #}
  13. {% macro stars(positive, negative) %}
  14.     {% set positive_stars = ["", "★", "★★", "★★★", "★★★★", "★★★★★"] %}
  15.     {% set negative_stars = ["", "☆", "☆☆", "☆☆☆", "☆☆☆☆", "☆☆☆☆☆"] %}
  16.     {{ positive_stars[positive] }}{{ negative_stars[negative] }}
  17. {% endmacro %}
  18. <style type="text/css">
  19.     #product_review_area {
  20.         border-top: 1px solid #E8E8E8;
  21.         padding-bottom: 0;
  22.         margin-bottom: 20px;
  23.     }
  24.     #product_review_area .ec-rectHeading {
  25.         cursor: pointer;
  26.         margin-top: 20px;
  27.         margin-bottom: 20px;
  28.     }
  29.     #product_review_area .ec-rectHeading.is_active i {
  30.         transform: rotate(180deg);
  31.     }
  32.     #product_review_area .review_list {
  33.         padding-left: 25px;
  34.     }
  35.     #product_review_area .review_list li {
  36.         margin-bottom: 16px;
  37.     }
  38.     #product_review_area .review_list .review_date {
  39.         font-weight: bold;
  40.     }
  41.     #product_review_area .recommend_average {
  42.         margin-left: 16px;
  43.         color: #DE5D50;
  44.     }
  45.     #product_review_area .review_list .recommend_level {
  46.         margin-left: 16px;
  47.         color: #DE5D50;
  48.     }
  49.     #product_review_area .review_list .recommend_name {
  50.         margin-left: 16px;
  51.     }
  52. </style>
  53. <script>
  54.     $(function() {
  55.         $('#product_review_area').appendTo($('.ec-layoutRole__main, .ec-layoutRole__mainWithColumn, .ec-layoutRole__mainBetweenColumn'));
  56.         $('#product_review_area .ec-rectHeading').on('click', function() {
  57.             $content = $('#reviewContent');
  58.             if ($content.css('display') == 'none') {
  59.                 $(this).addClass('is_active');
  60.                 $content.addClass('is_active');
  61.                 $content.slideDown(300);
  62.             } else {
  63.                 $(this).removeClass('is_active');
  64.                 $content.removeClass('is_active');
  65.                 $content.slideUp(300);
  66.             }
  67.             return false;
  68.         });
  69.     });
  70. </script>
  71. <!--▼レビューエリア-->
  72. <div id="product_review_area" class="product_review_area">
  73.   
  74.     <div class="ec-role">
  75.         {% set positive_avg_star = ProductReviewAvg %}
  76.         {% set negative_avg_star = 5 - positive_avg_star %}
  77.         <div class="ec-rectHeading is_active">
  78.             <h4>{{ 'product_review.front.product_detail.title'|trans }}
  79.                 <!--平均の星の数-->
  80.                 <span class="recommend_average">{{ stars.stars(positive_avg_star, negative_avg_star) }}</span>
  81.                 <!--レビュー数-->
  82.                 <span>({{ ProductReviewCount }})</span>
  83.                 <span class="chevron pull-right">
  84.                     <i class="fas fa-angle-up fa-lg"></i>
  85.                 </span>
  86.             </h4>
  87.         </div>
  88.         <div id="reviewContent">
  89.             {% if ProductReviews %}
  90.                 <ul class="review_list">
  91.                     {% for ProductReview in ProductReviews %}
  92.                         <li>
  93.                             <p class="review_date">
  94.                                 <!--投稿日-->
  95.                                 {{ ProductReview.create_date|date_day }}
  96.                                 <!--投稿者-->
  97.                                 <span class="recommend_name">
  98.                                             {% if ProductReview.reviewer_url %}
  99.                                                 <a href="{{ ProductReview.reviewer_url }}" rel="ugc nofollow"
  100.                                                    target="_blank">{{ 'product_review.front.product_detail.name'|trans({ '%name%': ProductReview.reviewer_name }) }}</a>
  101.                                             {% else %}
  102.                                                 {{ 'product_review.front.product_detail.name'|trans({ '%name%': ProductReview.reviewer_name }) }}
  103.                                             {% endif %}
  104.                                         </span>
  105.                                 <!--星の数-->
  106.                                 {% set positive_star = ProductReview.recommend_level %}
  107.                                 {% set negative_star = 5 - positive_star %}
  108.                                 <span class="recommend_level">
  109.                                             {{ stars.stars(positive_star, negative_star) }}
  110.                                         </span>
  111.                             </p>
  112.                             <!--タイトル-->
  113.                             <strong>{{ ProductReview.title }}</strong>
  114.                             <!--レビューコメント-->
  115.                             <p>{{ ProductReview.comment|nl2br }}</p>
  116.                         </li>
  117.                     {% endfor %}
  118.                 </ul>
  119.             {% else %}
  120.                 <p>{{ 'product_review.front.product_detail.no_review'|trans }}</p>
  121.             {% endif %}
  122.         </div>
  123.         <div>
  124.             <a href="{{ url('product_review_index', { id: Product.id }) }}"
  125.                class="ec-inlineBtn--action">{{ 'product_review.front.product_detail.post_review'|trans }}</a>
  126.         </div>
  127.     </div>
  128.   
  129.     <div class="accordion ec-role">
  130.       <details>
  131.       <summary>\教えてください!/<br>
  132.       <span class="small">あなたの声が「ステキの道しるべ」になります</span></summary>
  133.       <p>私たちは、一つひとつの商品がまっすぐ伝わるよう、心を込めて商品紹介をしています。<br>
  134.       ですが、実際に商品を手にしてくださった「リアルな声」に勝るものはありません。<br><br>
  135.       「この使い心地が好き」<br>
  136.       「こんな使い方もおすすめです」<br>
  137.       「リピートしている決め手は」<br><br>
  138.       そんな、あなただけの素直な声が、お気に入りアイテムと出会うための、何より大切な「道しるべ」となります。<br><br>
  139.       もしよろしければ、ほんのひとことでも構いません。<br>
  140.       あなたが感じた商品とのストーリーを、ぜひお聞かせいただけないでしょうか。<br>
  141.       温かいお声が集まることで、この場所がさらにお役に立てることを願っております。</p>
  142.       </details>
  143.       
  144.       <P class="orange bold mb40">レビュー投稿で300ポイント贈呈!詳しくは「レビューを投稿」ボタンから</P>
  145.       <P class="bold center mb40"><a class="underline" href="https://cosme.owl-horie.com/#top-review">全商品の新着レビューを見る</a></P>
  146.       
  147.     </div>
  148.   
  149. </div>
  150. <!-- ▲レビューエリア -->