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