custom/plugins/TcinnThemeWareModern/src/Resources/views/storefront/component/product/card/box.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/component/product/card/box.html.twig' %}
  2. {# ThemeWare® HC-Architecture® ready #}
  3. {# ---------------- START: SET TEMPLATE VARS ---------------- #}
  4. {# ThemeWare: Set theme variables #}
  5. {% set twtProductBoxImageHoverType = theme_config('twt-product-box-image-hover-type') %}
  6. {# ---------------- END: SET TEMPLATE VARS ---------------- #}
  7. {# ThemeWare: Adjustments on the product box #}
  8. {% block component_product_box_include %}
  9.     {# ThemeWare: Klasse 'twt-is-sold' hinzufügen falls "Produkte nach Abverkaufende abschwächen" aktiviert wurde. #}
  10.     {# TODO: Check if adding as class to product boxes will be made possible in further Shopware updates #}
  11.     {% if product.isCloseout and product.availableStock < product.minPurchase and not product.isGrouped %}
  12.         {% set twtBlockClasses = ['twt-is-sold'] %}
  13.     {% endif %}
  14.     {# ThemeWare: Klasse 'twt-is-topseller' hinzufügen falls das Produkt ein "Topseller" ist. #}
  15.     {# TODO: Check if adding as class to product boxes will be made possible in further Shopware updates #}
  16.     {% if product.markAsTopseller and twtBlockClasses is not empty %}
  17.         {% set twtBlockClasses = ['twt-is-topseller']|merge(twtBlockClasses) %}
  18.     {% elseif product.markAsTopseller and twtBlockClasses is empty %}
  19.         {% set twtBlockClasses = ['twt-is-topseller'] %}
  20.     {% endif %}
  21.     {% if twtBlockClasses is not empty %}
  22.         <div class="{{ twtBlockClasses|join(' ') }}"></div>
  23.     {% endif %}
  24.     {# ThemeWare: "Hover-Bild" für Überblendungen mit dem Cover-Bild ergänzen. #}
  25.     {% if twtProductBoxImageHoverType == 10 %}
  26.         {# initial ID array #}
  27.         {% set hoverMediaIds = [] %}
  28.         {% if searchResult.total > 0 %} {# Check if listing with searchResults #}
  29.             {% for product in searchResult %}
  30.                 {% if product.translated.customFields.twt_modern_pro_custom_field__product__hover_image is not empty %}
  31.                     {# simplify ID access #}
  32.                     {% set hoverMediaId = product.translated.customFields.twt_modern_pro_custom_field__product__hover_image %}
  33.                     {# merge IDs to a single array #}
  34.                     {% set hoverMediaIds = hoverMediaIds|merge([hoverMediaId]) %}
  35.                 {% endif %}
  36.             {% endfor %}
  37.         {% else %} {# Single product box #}
  38.             {% if product.translated.customFields.twt_modern_pro_custom_field__product__hover_image is not empty %}
  39.                 {# simplify ID access #}
  40.                 {% set hoverMediaId = product.translated.customFields.twt_modern_pro_custom_field__product__hover_image %}
  41.                 {# merge IDs to a single array #}
  42.                 {% set hoverMediaIds = hoverMediaIds|merge([hoverMediaId]) %}
  43.             {% endif %}
  44.         {% endif %}
  45.         {# do a single fetch from database #}
  46.         {% set mediaCollection = searchMedia(hoverMediaIds, context.context) %}
  47.     {% endif %}
  48.     {# Default block #}
  49.     {{ parent() }}
  50. {% endblock %}