vendor/store.shopware.com/mediameetsfbpixel/src/Resources/views/storefront/component/product/listing.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/component/product/listing.html.twig' %}
  2. {% block element_product_listing_row %}
  3.     {{ parent() }}
  4.     {% if config('mediameetsFbPixel.config.pixelIds') and config('mediameetsFbPixel.config.pixelIds') is not empty %}
  5.         {# Products #}
  6.         {% set _mmfbProducts = [] %}
  7.         {% if searchResult.total > 0 %}
  8.             {% for product in searchResult %}
  9.                 {% set _mmfbProducts = _mmfbProducts|merge([{ productNumber: product.productNumber }]) %}
  10.             {% endfor %}
  11.         {% endif %}
  12.         {# ID, Name #}
  13.         {% set activeCategory = page.header.navigation.active %}
  14.         {% set _mmfbLabel = '' %}
  15.         {% if activeRoute is same as('frontend.navigation.page') or activeRoute is same as('frontend.home.page') %}
  16.             {% set _mmfbLabel = activeCategory.name %}
  17.         {% elseif activeRoute is same as('frontend.search.page') %}
  18.             {% set _mmfbLabel = 'Search' %}
  19.         {% endif %}
  20.         {# Path #}
  21.         {% set _mmfbPath = [] %}
  22.         {% if activeRoute is same as('frontend.navigation.page') %}
  23.             {% for category in activeCategory.breadcrumb %}
  24.                 {% if loop.first is same as (false) %}
  25.                     {% set _mmfbPath = _mmfbPath|merge([category]) %}
  26.                 {% endif %}
  27.             {% endfor %}
  28.         {% endif %}
  29.         <script>
  30.             window.mediameetsFacebookPixelData.set('listing', {
  31.                 name: '{{ _mmfbLabel|e('js') }}',
  32.                 id: '{{ activeCategory.id }}',
  33.                 path: '{{ _mmfbPath|join(' > ')|e('js') }}',
  34.                 products: {{ _mmfbProducts|json_encode()|raw }}
  35.             });
  36.         </script>
  37.     {% endif %}
  38. {% endblock %}