src/Storefront/Resources/views/storefront/component/review/rating.html.twig line 1

  1. {% block component_review_rating %}
  2.     {% set full = points|round(0, 'floor')   %}
  3.     {% set left = ((points - full) * 4)|round %}
  4.     {% set left = left / 4 %}
  5.     {% if left > 0 %}
  6.         {% set half = 1 %}
  7.     {% endif %}
  8.     {% set blank = 5 - full - half  %}
  9.     {% block component_review_rating_output %}
  10.         <div class="product-review-rating">
  11.         {% if full > 0 %}
  12.             {% for star in range(1,full) %}
  13.                 {% sw_include '@Storefront/storefront/component/review/point.html.twig' with {
  14.                     type: 'full'
  15.                 } %}
  16.             {% endfor %}
  17.         {% endif %}
  18.         {% if half %}
  19.             {% sw_include '@Storefront/storefront/component/review/point.html.twig' with {
  20.                 type: 'half'
  21.             } %}
  22.         {% endif %}
  23.         {% if blank > 0 %}
  24.             {% for star in range(1,blank) %}
  25.                 {% sw_include '@Storefront/storefront/component/review/point.html.twig' with {
  26.                     type: 'blank'
  27.                 } %}
  28.             {% endfor %}
  29.         {% endif %}
  30.         </div>
  31.     {% endblock %}
  32. {% endblock %}