custom/apps/REVIEWSio/Resources/views/storefront/page/product-detail/review/review.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/page/product-detail/review/review.html.twig' %}
  2. {% block page_product_detail_review_tab_pane %}
  3. {% if config('REVIEWSio.config.showProductWidget') %}
  4.   <div id="ReviewsWidget"></div>
  5.   <script src="https://widget.reviews.co.uk/polaris/build.js"></script>
  6.   <script>
  7.   var loadReviewsioProductWidget = function() {
  8.       new ReviewsWidget('#ReviewsWidget', {
  9.       //Your REVIEWS.io account ID and widget type:
  10.       store: reviewsioUrlKey,
  11.       widget: 'polaris',
  12.       enable_sentiment_analysis: {{ config('REVIEWSio.config.sentimentAnalysis') ? 'true' : 'false' }},
  13.       
  14.       //Content settings (store_review,product_review,questions). Choose what to display in this widget:
  15.       options: {
  16.           types: 'product_review,questions',
  17.           lang: reviewsioCurrentLang,
  18.           //Possible layout options: bordered, large and reverse.
  19.           layout: '',
  20.           //How many reviews & questions to show per page?
  21.           per_page: 15,
  22.           //Product specific settings. Provide product SKU for which reviews should be displayed:
  23.           product_review:{
  24.               //Display product reviews - include multiple product SKUs seperated by Semi-Colons (Main Identifier in your product catalog )
  25.               sku: '{{page.product.productNumber}}',
  26.               hide_if_no_results: false,
  27.               structured_data: {
  28.                 category: "{{page.product.seoCategory.breadcrumb | join(' > ')}}",
  29.                 gtin: "{{page.product.ean}}",
  30.                 url: window.location.href,
  31.                 image: "{{page.product.cover.media.url}}",
  32.                 description: {{page.product.translated.metaDescription | striptags | json_encode | raw}},
  33.                 offers: [{
  34.                   type: "Offer",
  35.                   price: "{{page.product.calculatedPrice.totalPrice}}",
  36.                   priceCurrency: "{{context.currency.isoCode}}",
  37.                   url: window.location.href,
  38.                   availability: "http://schema.org/{% if page.product.available == true %}InStock{% else %}OutOfStock{% endif %}",
  39.                   priceValidUntil: new Date(Date.now() + (30 * 24 * 60 * 60 * 1000)).toISOString().split('T')[0],
  40.                 }],
  41.                 brand: {
  42.                   type: "Brand",
  43.                   name: "{{page.product.manufacturer.name}}",
  44.                 }
  45.             },
  46.           },
  47.           //Questions settings:
  48.           questions:{
  49.               hide_if_no_results: false,
  50.               enable_ask_question: true,
  51.               show_dates: true,
  52.               grouping: '{% for keys in page.product.cheapestPriceContainer.value|keys %}{{keys}};{% endfor %}',
  53.           },
  54.           //Header settings:
  55.           header:{
  56.               enable_summary: true, //Show overall rating & review count
  57.               enable_ratings: true,
  58.               enable_attributes: true,
  59.               enable_header_logo: false,
  60.               enable_image_gallery: true, //Show photo & video gallery
  61.               enable_percent_recommended: false, //Show what percentage of reviewers recommend it
  62.               enable_write_review: {% if config('REVIEWSio.config.disableWriteReview') is not empty %}false{% else %}true{% endif %}, //Show "Write Review" button
  63.               enable_ask_question: true, //Show "Ask Question" button
  64.               enable_sub_header: true, //Show subheader
  65.           },
  66.           //Filtering settings:
  67.           filtering:{
  68.               enable: true, //Show filtering options
  69.               enable_text_search: true, //Show search field
  70.               enable_sorting: true, //Show sorting options (most recent, most popular)
  71.               enable_overall_rating_filter: true, //Show overall rating breakdown filter
  72.               enable_ratings_filters: true, //Show product attributes filter
  73.               enable_attributes_filters: true, //Show author attributes filter
  74.           },
  75.           //Review settings:
  76.           reviews:{
  77.               enable_avatar: true, //Show author avatar
  78.               enable_reviewer_name:  true, //Show author name
  79.               enable_reviewer_address:  true, //Show author location
  80.               reviewer_address_format: 'city, country', //Author location display format
  81.               enable_verified_badge: true, //Show "Verified Customer" badge
  82.               enable_reviewer_recommends: true, //Show "I recommend it" badge
  83.               enable_attributes: true, //Show author attributes
  84.               enable_product_name: true, //Show display product name
  85.               enable_review_title: undefined, //Show review title
  86.               enable_replies: {% if config('REVIEWSio.config.enableReplies') is not empty %}true{% else %}false{% endif %}, //Show review replies
  87.               enable_images: true, //Show display review photos
  88.               enable_ratings: true, //Show product attributes (additional ratings)
  89.               enable_share: true, //Show share buttons
  90.               enable_helpful_vote: true, //Show "was this helpful?" section
  91.               enable_helpful_display: true, //Show how many times times review upvoted
  92.               enable_report: true, //Show report button
  93.               enable_date: true, //Show when review was published
  94.           },
  95.       },
  96.       //Style settings:
  97.       {% if config('REVIEWSio.config.productReviewsWidgetStyles') is not empty %}
  98.         {{ config('REVIEWSio.config.productReviewsWidgetStyles') | raw }}
  99.       {% else %}
  100.         styles: {
  101.             //Base font size is a reference size for all text elements. When base value gets changed, all TextHeading and TexBody elements get proportionally adjusted.
  102.             '--base-font-size': '16px',
  103.             //Button styles (shared between buttons):
  104.             '--common-button-font-family': 'inherit',
  105.             '--common-button-font-size':'16px',
  106.             '--common-button-font-weight':'500',
  107.             '--common-button-letter-spacing':'0',
  108.             '--common-button-text-transform':'none',
  109.             '--common-button-vertical-padding':'10px',
  110.             '--common-button-horizontal-padding':'20px',
  111.             '--common-button-border-width':'2px',
  112.             '--common-button-border-radius':'0px',
  113.             //Primary button styles:
  114.             '--primary-button-bg-color': '#0E1311',
  115.             '--primary-button-border-color': '#0E1311',
  116.             '--primary-button-text-color': '#ffffff',
  117.             //Secondary button styles:
  118.             '--secondary-button-bg-color': 'transparent',
  119.             '--secondary-button-border-color': '#0E1311',
  120.             '--secondary-button-text-color': '#0E1311',
  121.             //Star styles:
  122.             '--common-star-color': '{% if config('REVIEWSio.config.starColour') is empty %}#f47e27{% else %}{{config('REVIEWSio.config.starColour')}}{% endif %}',
  123.             '--common-star-disabled-color': 'rgba(0,0,0,0.25)',
  124.             '--medium-star-size': '22px',
  125.             '--small-star-size': '19px',
  126.             //Heading styles:
  127.             '--heading-text-color': '#0E1311',
  128.             '--heading-text-font-weight': '600',
  129.             '--heading-text-font-family': 'inherit',
  130.             '--heading-text-line-height': '1.4',
  131.             '--heading-text-letter-spacing': '0',
  132.             '--heading-text-transform': 'none',
  133.             //Body text styles:
  134.             '--body-text-color': '#0E1311',
  135.             '--body-text-font-weight': '400',
  136.             '--body-text-font-family': 'inherit',
  137.             '--body-text-line-height': '1.4',
  138.             '--body-text-letter-spacing': '0',
  139.             '--body-text-transform': 'none',
  140.             //Input field styles:
  141.             '--inputfield-text-font-family': 'inherit',
  142.             '--input-text-font-size': '14px',
  143.             '--inputfield-text-font-weight': '400',
  144.             '--inputfield-text-color': '#0E1311',
  145.             '--inputfield-border-color': 'rgba(0,0,0,0.2)',
  146.             '--inputfield-background-color': 'transparent',
  147.             '--inputfield-border-width': '1px',
  148.             '--inputfield-border-radius': '0px',
  149.             '--common-border-color': 'rgba(0,0,0,0.15)',
  150.             '--common-border-width': '1px',
  151.             '--common-sidebar-width': '190px',
  152.             //Slider indicator (for attributes) styles:
  153.             '--slider-indicator-bg-color': 'rgba(0,0,0,0.1)',
  154.             '--slider-indicator-button-color': '#0E1311',
  155.             '--slider-indicator-width': '190px',
  156.             //Badge styles:
  157.             '--badge-icon-color': '#0E1311',
  158.             '--badge-icon-font-size': 'inherit',
  159.             '--badge-text-color': '#0E1311',
  160.             '--badge-text-font-size': 'inherit',
  161.             '--badge-text-letter-spacing': 'inherit',
  162.             '--badge-text-transform': 'inherit',
  163.             //Author styles:
  164.             '--author-font-size': 'inherit',
  165.             '--author-text-transform': 'none',
  166.             //Author avatar styles:
  167.             '--avatar-thumbnail-size': '60px',
  168.             '--avatar-thumbnail-border-radius': '100px',
  169.             '--avatar-thumbnail-text-color': '#0E1311',
  170.             '--avatar-thumbnail-bg-color': 'rgba(0,0,0,0.1)',
  171.             //Product photo or review photo styles:
  172.             '--photo-video-thumbnail-size': '80px',
  173.             '--photo-video-thumbnail-border-radius': '0px',
  174.             //Media (photo & video) slider styles:
  175.             '--mediaslider-scroll-button-icon-color': '#0E1311',
  176.             '--mediaslider-scroll-button-bg-color': 'rgba(255, 255, 255, 0.85)',
  177.             '--mediaslider-overlay-text-color': '#ffffff',
  178.             '--mediaslider-overlay-bg-color': 'rgba(0, 0, 0, 0.8))',
  179.             '--mediaslider-item-size': '110px',
  180.             //Pagination & tabs styles (normal):
  181.             '--pagination-tab-text-color': '#0E1311',
  182.             '--pagination-tab-text-transform': 'none',
  183.             '--pagination-tab-text-letter-spacing': '0',
  184.             '--pagination-tab-text-font-size': '16px',
  185.             '--pagination-tab-text-font-weight': '600',
  186.             //Pagination & tabs styles (active):
  187.             '--pagination-tab-active-text-color': '#0E1311',
  188.             '--pagination-tab-active-text-font-weight': '600',
  189.             '--pagination-tab-active-border-color': '#0E1311',
  190.             '--pagination-tab-border-width': '3px',
  191.         },
  192.       {% endif %}
  193.       });
  194.       snippet = document.querySelector(".ruk_rating_snippet");
  195.       polaris = document.querySelector("#ReviewsWidget");
  196.       reviewTab = document.querySelector("#review-tab");
  197.       if(polaris && snippet) {
  198.         snippet.onclick = function(event) {
  199.           if(reviewTab) {
  200.             reviewTab.click();
  201.           }
  202.           setTimeout(function() {
  203.             polaris.scrollIntoView({ block: 'start',  behavior: 'smooth' });
  204.           }, 500);
  205.         }
  206.       }
  207.   }
  208.   </script>
  209. {% else %}
  210.   {{ parent() }}
  211. {% endif %}
  212. {% endblock %}