app/template/plugin/CustomerReview42/Block/customer_review4_product_list.twig line 1

Open in your IDE?
  1. {% include('@CustomerReview42/Block/customer_review4_recommend_css.twig') %}
  2. {% import('@CustomerReview42/Block/customer_review4_recommend_macro.twig') as recommend_macro %}
  3. {% if pagination.totalItemCount > 0 %}
  4.     {% for Product in pagination %}
  5. {% set review_list = repository('Plugin\\CustomerReview42\\Entity\\CustomerReviewTotal').getRecommend(Product.id) %}
  6. {% set reviewer_total = 0 %}
  7. {% set review_total_point = 0 %}
  8. {% set count = 5 %}
  9. {% for i in review_list %}
  10.     {% set reviewer_total = reviewer_total + i %}
  11.     {% set review_total_point = review_total_point + i * count %}
  12.     {% set count = count - 1 %}
  13. {% endfor %}
  14. {% set review_point = reviewer_total == 0 ? 0  : (review_total_point / reviewer_total) %}
  15. {% if 0 < reviewer_total %}
  16.     <div id="plg_customer_review{{Product.id}}" class="review-layoutRole product_list">
  17.         <h3 class="review_score" data-id="{{ Product.id }}" data-avg="{{ review_point }}" data-num="{{ reviewer_total }}" data-starsize="22" data-mstarsize="14" data-imgbase="{{ asset('aneros/img/products/') }}">
  18.             <span class="review_all_score_image" style="display: inline-block"></span>
  19.             <a href="{{ url('product_detail', {'id': Product.id}) }}#review_area"><span class="review_all_score"></span></a>
  20.         </h3>
  21.     </div>
  22. {% endif %}
  23. <script>
  24.   $(function () {
  25.     if ( $('#plg_customer_review_anchor{{Product.id}}').length) {
  26.         $('#plg_customer_review{{Product.id}}').insertAfter($('#plg_customer_review_anchor{{Product.id}}'));
  27.     } else if ( $('#productForm{{Product.id}}').length) {
  28.         $('#plg_customer_review{{Product.id}}').insertBefore($('#productForm{{Product.id}}'));
  29.     } else {
  30.         $('#plg_customer_review{{Product.id}}').hide();
  31.     }
  32.   });
  33. </script>
  34.     {% endfor %}
  35. {% endif %}