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

Open in your IDE?
  1. {% sw_extends '@fourtwosixAttributeBadges/storefront/component/product/card/box-standard.html.twig' %}
  2. {# @fourtwosix-edit: RD addedd triangles badge }} #}
  3. {% block component_product_box_info %}
  4.     <div class="d-flex fourtwosix-badges">
  5.         {% set badgesMediaIds = [] %}
  6.         {% set propertiesBadge = [] %}
  7.         {% set configDefaultMedia = config('fourtwosixAttributeBadges.config.defaultMedia') %}
  8.         {# checks whether the property group has a customField attribute_badge #}
  9.         {% if product.sortedProperties != null %}
  10.             {% for x in product.sortedProperties|filter(x => x.translated.customFields.attribute_badges == true) -%}
  11.                 {% set propertiesBadge = propertiesBadge|merge(x.options.elements) %}
  12.             {% endfor %}
  13.             {% if propertiesBadge %}
  14.                 {% for badge in propertiesBadge %}
  15.                     {% if badge.mediaId != null %}
  16.                         {% set badgesMediaIds = badgesMediaIds|merge([badge.mediaId]) %}
  17.                     {% else %}
  18.                         {% set badgesMediaIds = badgesMediaIds|merge([configDefaultMedia]) %}
  19.                     {% endif %}
  20.                 {% endfor %}
  21.                 {% set mediaCollection = searchMedia(badgesMediaIds, context.context) %}
  22.                 {% for badge in propertiesBadge|sort((a, b) => a.position <=> b.position)|slice(0,8) %}
  23.                     {% if badge.translated.name|length  <= 5 %}
  24.                         {% set  badgeLengthClass = "5" %}
  25.                     {% elseif badge.translated.name|length  === 6 %}
  26.                         {% set  badgeLengthClass = "6" %}
  27.                     {% elseif badge.translated.name|length  >= 7 %}
  28.                         {% set  badgeLengthClass = "7" %}
  29.                     {% endif %}
  30.                     {% if badge.mediaId != null %}
  31.                         {% set badgeMedia = mediaCollection.get(badge.mediaId) %}
  32.                         {% sw_thumbnails 'product-detail-badge-thumbnails' with {
  33.                             media: badgeMedia,
  34.                             attributes: {
  35.                                 'class': 'img-fluid badgeImgListing',
  36.                                 'data-toggle' : 'tooltip',
  37.                                 'title': badge.group.translated.name ~ ': ' ~ badge.translated.name
  38.                             }
  39.                         } %}
  40.                     {% elseif badge.group.translated.customFields.fts_property_group_custom_graphics_option %}
  41.                         <div class="dynamic-badge-box arrow-badge"
  42.                             data-toggle="tooltip"
  43.                             data-placement="top"
  44.                             title="{{ badge.group.translated.name }}: {{ badge.translated.name }}">
  45.                             <div class="option-label length-{{ badgeLengthClass }}">
  46.                                 {{ badge.translated.name|length > 7 ? badge.translated.name|slice(0, 7) ~ '...' : badge.translated.name }}
  47.                             </div>
  48.                         </div>
  49.                     {% else %}
  50.                         <div class="dynamic-badge-box"
  51.                             data-toggle="tooltip"
  52.                             data-placement="top"
  53.                             title="{{ badge.group.translated.name }}: {{ badge.translated.name }}">
  54.                             <div class="option-label length-{{ badgeLengthClass }}">
  55.                                 {{ badge.translated.name|length > 7 ? badge.translated.name|slice(0, 7) ~ '...' : badge.translated.name }}
  56.                             </div>
  57.                         </div>
  58.                     {% endif %}
  59.                 {% endfor %}
  60.             {% endif %}
  61.         {% endif %}
  62.     </div>
  63.     {{block('component_product_box_info', '@zenitPlatformStratus/storefront/component/product/card/box-standard.html.twig')}}
  64. {% endblock %}