src/Storefront/Resources/views/storefront/page/product-detail/review/review-widget.html.twig line 1

  1. {% block page_product_detail_review_widget %}
  2.     <div class="sticky-top product-detail-review-widget">
  3.         {% block page_product_detail_review_info_container %}
  4.             {% block page_product_detail_review_info %}
  5.                 <div class="product-detail-review-info js-review-info">
  6.                     {% block page_product_detail_review_title %}
  7.                         <p class="product-detail-review-title h5">
  8.                             {{ "detail.reviewTitle"|trans({'%count%': reviews.total, '%total%':reviews.totalReviews })|sw_sanitize }}
  9.                         </p>
  10.                     {% endblock %}
  11.                     {% block page_product_detail_review_overview %}
  12.                         <div class="product-detail-review-rating"
  13.                             {% if productReviewCount > 0 %}
  14.                                 itemprop="aggregateRating" itemscope itemtype="https://schema.org/AggregateRating"
  15.                             {% endif %}>
  16.                             {% if productReviewCount > 0 %}
  17.                                 <meta itemprop="bestRating" content="5">
  18.                                 <meta itemprop="ratingCount" content="{{ productReviewCount }}">
  19.                                 <meta itemprop="ratingValue" content="{{ productAvgRating }}">
  20.                             {% endif %}
  21.                             {% sw_include '@Storefront/storefront/component/review/rating.html.twig' with {
  22.                                 points: productAvgRating,
  23.                                 style: 'text-primary'
  24.                             } %}
  25.                             {% if productReviewCount > 0 %}
  26.                                 <p class="h6">
  27.                                     {{ productAvgRating }} {{ "detail.reviewAvgRate"|trans|sw_sanitize }} {{ reviews.matrix.maxPoints }} {{ "detail.reviewAvgRateElements"|trans }}
  28.                                 </p>
  29.                             {% endif %}
  30.                         </div>
  31.                     {% endblock %}
  32.                 </div>
  33.             {% endblock %}
  34.             {% if productReviewCount > 0 %}
  35.                 <hr>
  36.             {% endif %}
  37.             {% set formAjaxSubmitOptions = {
  38.                 replaceSelectors: [".js-review-container"],
  39.                 submitOnChange: true
  40.             } %}
  41.             {% block page_product_detail_review_filter %}
  42.                 {% if productReviewCount > 0 %}
  43.                     <div class="js-review-filter">
  44.                         <form class="review-filter-form"
  45.                               action="{{ path('frontend.product.reviews', { productId: reviews.productId, parentId: reviews.parentId }) }}"
  46.                               method="post"
  47.                               data-form-ajax-submit="true"
  48.                               data-form-ajax-submit-options='{{ formAjaxSubmitOptions|json_encode }}'>
  49.                             {% if app.request.get('limit') %}
  50.                                 <input type="hidden" name="limit" value="{{ app.request.get('limit') }}">
  51.                             {% endif %}
  52.                             {% if app.request.get('language') %}
  53.                                 <input type="hidden" name="language" value="{{ app.request.get('language') }}">
  54.                             {% endif %}
  55.                             {% if app.request.get('sort') %}
  56.                                 <input type="hidden" name="sort" value="{{ app.request.get('sort') }}">
  57.                             {% endif %}
  58.                             {% for matrix in reviews.matrix.matrix %}
  59.                                 {% block page_product_detail_review_filter_box %}
  60.                                     <div class="row product-detail-review-filter">
  61.                                         {% block page_product_detail_review_filter_checkbox %}
  62.                                             <div class="col-md-8 col-lg-5 product-detail-review-checkbox">
  63.                                                 <div class="form-check">
  64.                                                     {% block page_product_detail_review_filter_checkbox_input %}
  65.                                                         <input type="checkbox"
  66.                                                                class="form-check-input"
  67.                                                                id="reviewRating{{ matrix.points }}"
  68.                                                                name="points[]"
  69.                                                             {% if app.request.get('points') %}
  70.                                                                 {% for points in app.request.get('points') %}
  71.                                                                     {% if points == matrix.points %}
  72.                                                                         checked="checked"
  73.                                                                     {% endif %}
  74.                                                                 {% endfor %}
  75.                                                             {% endif %}
  76.                                                                value="{{ matrix.points }}"
  77.                                                             {% if matrix.count < 1 %}disabled{% endif %}>
  78.                                                     {% endblock %}
  79.                                                     {% block page_product_detail_review_filter_checkbox_label %}
  80.                                                         <label class="custom-control-label text-nowrap"
  81.                                                                for="reviewRating{{ matrix.points }}">
  82.                                                             <small>{{ "detail.review#{matrix.points}PointRatingText"|trans|sw_sanitize }}
  83.                                                                 ({{ matrix.count }})</small>
  84.                                                         </label>
  85.                                                     {% endblock %}
  86.                                                 </div>
  87.                                             </div>
  88.                                         {% endblock %}
  89.                                         {% block page_product_detail_review_filter_progressbar %}
  90.                                             <div class="col d-none d-lg-block product-detail-review-progressbar-col">
  91.                                                 <div class="progress product-detail-review-progressbar-container">
  92.                                                     <div class="progress-bar product-detail-review-progressbar-bar"
  93.                                                          role="progressbar"
  94.                                                          style="width: {{ matrix.percent }}%;"
  95.                                                          aria-valuenow="{{ matrix.percent }}"
  96.                                                          aria-valuemin="0"
  97.                                                          aria-valuemax="100"></div>
  98.                                                 </div>
  99.                                             </div>
  100.                                         {% endblock %}
  101.                                         {% block page_product_detail_review_filter_share %}
  102.                                             <div class="col-12 col-md-3 product-detail-review-share">
  103.                                                 <p><small>{{ matrix.percent|round }}%</small></p>
  104.                                             </div>
  105.                                         {% endblock %}
  106.                                     </div>
  107.                                 {% endblock %}
  108.                             {% endfor %}
  109.                         </form>
  110.                     </div>
  111.                     {% block page_product_detail_review_filter_divider %}
  112.                         <hr/>
  113.                     {% endblock %}
  114.                 {% endif %}
  115.             {% endblock %}
  116.         {% endblock %}
  117.         {% block page_product_detail_review_form_teaser %}
  118.             <div class="product-detail-review-teaser js-review-teaser">
  119.                 {% block page_product_detail_review_form_teaser_header %}
  120.                     <p class="h4">
  121.                         {% if not reviews.customerReview %}
  122.                             {{ "detail.reviewTeaserTitle"|trans|sw_sanitize }}
  123.                         {% else %}
  124.                             {{ "detail.reviewExistsTeaserTitle"|trans|sw_sanitize }}
  125.                         {% endif %}
  126.                     </p>
  127.                 {% endblock %}
  128.                 {% block page_product_detail_review_form_teaser_text %}
  129.                     <p>
  130.                         {% if not reviews.customerReview %}
  131.                             {{ "detail.reviewTeaserText"|trans|sw_sanitize }}
  132.                         {% else %}
  133.                             {{ "detail.reviewExistsTeaserText"|trans|sw_sanitize }}
  134.                         {% endif %}
  135.                     </p>
  136.                 {% endblock %}
  137.                 {% block page_product_detail_review_form_teaser_button %}
  138.                     <button class="btn btn-primary product-detail-review-teaser-btn"
  139.                             type="button"
  140.                             data-bs-toggle="collapse"
  141.                             data-bs-target=".multi-collapse"
  142.                             aria-expanded="false"
  143.                             aria-controls="review-form review-list">
  144.                         <span class="product-detail-review-teaser-show">
  145.                             {% if not reviews.customerReview %}
  146.                                 {{ "detail.reviewTeaserButton"|trans|sw_sanitize }}
  147.                             {% else %}
  148.                                 {{ "detail.reviewExistsTeaserButton"|trans|sw_sanitize }}
  149.                             {% endif %}
  150.                         </span>
  151.                         <span class="product-detail-review-teaser-hide">
  152.                             {{ "detail.reviewTeaserButtonHide"|trans|sw_sanitize }}
  153.                         </span>
  154.                     </button>
  155.                 {% endblock %}
  156.             </div>
  157.         {% endblock %}
  158.     </div>
  159. {% endblock %}