{% block dis_ga4_pagination_products_extensions %}
{% set productsExtension = searchResult.elements %}
{% if productsExtension is not null %}
<div class="d-none discoga4-pagination-hidden-products-information">
{% block disco_ga4_pagination_hidden_products_information %}
{% set bigCategoriesList = ga4GetCategoriesSQLCached(productsExtension,context.context) %}
{% for product in productsExtension %}
{% block disco_ga4_pagination_hidden_single_product_information %}
{% set price = product.calculatedPrice %}
{% if product.calculatedPrices|length == 1 %}
{% set price = product.calculatedPrices.first %}
{% endif %}
{% set listPrice = price.listPrice %}
{% if listPrice.percentage > 0 %}
{% set listingPrice = price.listPrice.price %}
{% else %}
{% set listingPrice = price.unitPrice %}
{% endif %}
{% set variantText = '' %}
{% if product.variation %}
{% for variation in product.variation %}
{% set variantText = variantText ~ ' ' ~ variation.group ~ ' ' ~ variation.option ~ ' -' %}
{% endfor %}
{% endif %}
{% set ga4Id = 'ga4-product-' ~ product.id %}
{% if product.manufacturer %}
{% set itemBrand = product.manufacturer.translated.name %}
{% else %}
{% set itemBrand = ga4GetManufacturerSQL(product.manufacturerId,context.context) %}
{% endif %}
{% if product.calculatedPrices.count > 0 %}
{% set startPrice = product.calculatedPrices.first.unitPrice %}
{% set hasGraduatedPrice = true %}
{% else %}
{% set startPrice = price.unitPrice %}
{% set hasGraduatedPrice = false %}
{% endif %}
{% if controllerName|lower == 'product' %}
{% set item_list_id = 'product' %}
{% set item_list_name = 'product' %}
{% elseif controllerName|lower == 'navigation' %}
{% set item_list_id = page.header.navigation.active.id %}
{% set item_list_name = page.header.navigation.active.name %}
{% elseif controllerName|lower == 'search' %}
{% set item_list_id = 'search' %}
{% set item_list_name = 'search' %}
{% endif %}
{% set item_category = [] %}
{% if bigCategoriesList[product.id] %}
{% for key,value in bigCategoriesList[product.id] %}
{% set item_category = item_category|merge([value]) %}
{% endfor %}
{% endif %}
{% block disco_ga4_pagination_single_product_hidden_line_item %}
<span class="discoga4-pagination-hidden-line-item hidden-line-item"
data-id="{{ product.id }}"
data-item_brand="{{ itemBrand }}"
data-item_name="{{ product.translated.name }}"
data-min-purchase="{{ product.minPurchase }}"
data-shopware_id="{{ product.id }}"
data-item_id="{{ product.productNumber }}"
data-real-price="{{ listingPrice }}"
data-item_startPrice="{{ startPrice }}"
data-item_hasGraduatedPrice="{{ hasGraduatedPrice }}"
data-item_list_id="{{ item_list_id }}"
data-item_list_name="{{ item_list_name }}"
data-tax-rate="{{ product.tax.taxRate }}"
data-cheapest="{{ price.unitPrice }}"
data-currency="{{ context.currency.translated.shortName }}"
data-item_variant="{{ variantText | trim(' ','left') | trim('-','right') }}"
data-item_category="{{ item_category|join('|') }}"
>
</span>
{% endblock %}
{% endblock %}
{% endfor %}
{% endblock %}
</div>
{% endif %}
{% endblock %}