custom/plugins/DIScoGA4/src/Resources/views/storefront/ga4/ga4-pagination-products-extensions.html.twig line 1

Open in your IDE?
  1. {% block dis_ga4_pagination_products_extensions %}
  2.     {% set productsExtension = searchResult.elements %}
  3.     {% if productsExtension is not null %}
  4.         <div class="d-none discoga4-pagination-hidden-products-information">
  5.             {% block disco_ga4_pagination_hidden_products_information %}
  6.                 {% set bigCategoriesList = ga4GetCategoriesSQLCached(productsExtension,context.context) %}
  7.                 {% for product in productsExtension %}
  8.                     {% block disco_ga4_pagination_hidden_single_product_information %}
  9.                         {% set price = product.calculatedPrice %}
  10.                         {% if product.calculatedPrices|length == 1 %}
  11.                             {% set price = product.calculatedPrices.first %}
  12.                         {% endif %}
  13.                         {% set listPrice = price.listPrice %}
  14.                         {% if listPrice.percentage > 0 %}
  15.                             {% set listingPrice = price.listPrice.price %}
  16.                         {% else %}
  17.                             {% set listingPrice = price.unitPrice %}
  18.                         {% endif %}
  19.                         {% set variantText = '' %}
  20.                         {% if product.variation %}
  21.                             {% for variation in product.variation %}
  22.                                 {% set variantText = variantText ~ ' ' ~ variation.group ~ ' ' ~ variation.option ~ ' -' %}
  23.                             {% endfor %}
  24.                         {% endif %}
  25.                         {% set ga4Id = 'ga4-product-' ~ product.id %}
  26.                         {% if product.manufacturer %}
  27.                             {% set itemBrand = product.manufacturer.translated.name %}
  28.                         {% else %}
  29.                             {% set itemBrand = ga4GetManufacturerSQL(product.manufacturerId,context.context) %}
  30.                         {% endif %}
  31.                         {% if product.calculatedPrices.count > 0 %}
  32.                             {% set startPrice = product.calculatedPrices.first.unitPrice %}
  33.                             {% set hasGraduatedPrice = true %}
  34.                         {% else %}
  35.                             {% set startPrice = price.unitPrice %}
  36.                             {% set hasGraduatedPrice = false %}
  37.                         {% endif %}
  38.                         {% if controllerName|lower == 'product' %}
  39.                             {% set item_list_id = 'product' %}
  40.                             {% set item_list_name = 'product' %}
  41.                         {% elseif controllerName|lower == 'navigation' %}
  42.                             {% set item_list_id = page.header.navigation.active.id  %}
  43.                             {% set item_list_name = page.header.navigation.active.name %}
  44.                         {% elseif controllerName|lower == 'search' %}
  45.                             {% set item_list_id = 'search' %}
  46.                             {% set item_list_name = 'search' %}
  47.                         {% endif %}
  48.                         {% set item_category = [] %}
  49.                         {% if bigCategoriesList[product.id] %}
  50.                             {% for key,value  in bigCategoriesList[product.id] %}
  51.                                 {% set item_category = item_category|merge([value]) %}
  52.                             {% endfor %}
  53.                         {% endif %}
  54.                         {% block disco_ga4_pagination_single_product_hidden_line_item %}
  55.                             <span class="discoga4-pagination-hidden-line-item hidden-line-item"
  56.                                   data-id="{{ product.id }}"
  57.                                   data-item_brand="{{ itemBrand }}"
  58.                                   data-item_name="{{ product.translated.name  }}"
  59.                                   data-min-purchase="{{ product.minPurchase }}"
  60.                                   data-shopware_id="{{ product.id }}"
  61.                                   data-item_id="{{ product.productNumber }}"
  62.                                   data-real-price="{{ listingPrice }}"
  63.                                   data-item_startPrice="{{ startPrice }}"
  64.                                   data-item_hasGraduatedPrice="{{ hasGraduatedPrice }}"
  65.                                   data-item_list_id="{{ item_list_id }}"
  66.                                   data-item_list_name="{{ item_list_name }}"
  67.                                   data-tax-rate="{{ product.tax.taxRate }}"
  68.                                   data-cheapest="{{ price.unitPrice }}"
  69.                                   data-currency="{{ context.currency.translated.shortName }}"
  70.                                   data-item_variant="{{ variantText | trim(' ','left') | trim('-','right') }}"
  71.                                   data-item_category="{{ item_category|join('|') }}"
  72.                             >
  73.                             </span>
  74.                         {% endblock %}
  75.                     {% endblock %}
  76.                 {% endfor %}
  77.             {% endblock %}
  78.         </div>
  79.     {% endif %}
  80. {% endblock %}