custom/plugins/NetiNextGoogleCustomerReviews/src/Resources/views/storefront/base.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/base.html.twig' %}
  2. {% block base_script_hmr_mode %}
  3.     {{ parent() }}
  4.     {% if page.extensions.NetiNextGoogleCustomerReviewsFrontend
  5.         or page.extensions.netiNextGoogleCustomerReviewsFinish %}
  6.         <script src="https://apis.google.com/js/platform.js?onload=netiPlatformLoaded" async defer></script>
  7.         <script type="text/javascript">
  8.             window.netiPlatformLoaded = function() {
  9.                 {% if page.extensions.NetiNextGoogleCustomerReviewsFrontend %}
  10.                 {% set struct = page.extensions.NetiNextGoogleCustomerReviewsFrontend %}
  11.                 var ratingBadgeContainer = document.createElement('div');
  12.                 document.body.appendChild(ratingBadgeContainer);
  13.                 window.gapi.load('ratingbadge', function() {
  14.                     window.gapi.ratingbadge.render(
  15.                         ratingBadgeContainer,
  16.                         {
  17.                             merchant_id: "{{ struct.merchantId }}",
  18.                             position: "{{ struct.position }}"
  19.                         }
  20.                     );
  21.                 });
  22.                 {% endif %}
  23.                 {% if page.extensions.netiNextGoogleCustomerReviewsFinish %}
  24.                 {% set struct = page.extensions.netiNextGoogleCustomerReviewsFinish %}
  25.                 window.gapi.load('surveyoptin', function() {
  26.                     window.gapi.surveyoptin.render(
  27.                         {
  28.                             merchant_id: "{{ struct.merchantId }}",
  29.                             order_id: "{{ struct.orderId }}",
  30.                             email: "{{ struct.email }}",
  31.                             delivery_country: "{{ struct.deliveryCountry }}",
  32.                             estimated_delivery_date: "{{ struct.estimatedDeliveryDate|date("Y-m-d") }}",
  33.                             {% if struct.optionalFields %}
  34.                             {{ struct.optionalFields }}
  35.                             {% endif %}
  36.                             {% if struct.products|length > 0 %}
  37.                             products: {{ struct.products|json_encode|raw }}
  38.                             {% endif %}
  39.                         }
  40.                     );
  41.                 });
  42.                 {% endif %}
  43.             };
  44.         </script>
  45.     {% endif %}
  46. {% endblock %}