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

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/component/product/card/box-standard.html.twig' %}
  2. {% block component_product_box %}
  3.     {% if product %}
  4.         {% set name = product.translated.name %}
  5.         {# Custom switch, as we want product cards to link to the Parent product (so no variation is selected), instead of the product variation itself. #}
  6.         {% if product.parentId is not null %}
  7.             {% set id = product.parentId %}
  8.         {% else %}
  9.             {% set id = product.id %}
  10.         {% endif %}
  11.         {% set cover = product.cover.media %}
  12.         {% set variation = product.variation %}
  13.         {% set displayParent = product.variantListingConfig.displayParent and product.parentId === null %}
  14.         {% set productUrl = seoUrl('frontend.detail.page', { 'productId': id }) %}
  15.         <div class="product-box box-{{ layout }} h-full group">
  16.             {% block component_product_box_content %}
  17.                 {{ parent() }}
  18.             {% endblock %}
  19.         </div>
  20.     {% endif %}
  21. {% endblock %}
  22. {% block component_product_box_image_link_inner %}
  23.     {% if cover.url %}
  24.         {% set attributes = {
  25.             class: 'product-image cover',
  26.             alt: cover.translated.alt ? : name,
  27.             title: cover.translated.title ? : name
  28.         } %}
  29.         {% sw_thumbnails 'product-image-thumbnails'
  30.             with
  31.             {
  32.                 media: cover,
  33.                 sizes: {
  34.                 'xs': '308px',
  35.                 'md': '420px',
  36.                 'xl': '868px'
  37.             }
  38.             } %}
  39.         {% if 'secondMediaExtension' in product.extensions|keys %}
  40.             {% set secondMedia = product.extensions.secondMediaExtension.secondMedia.media %}
  41.             {% set attributes = {
  42.                 class: 'product-image product-image-hover hidden opacity-0 hover:opacity-100 md:block transition cover',
  43.                 alt: secondMedia.translated.alt ? : name,
  44.                 title: secondMedia.translated.title ? : name
  45.             } %}
  46.             {% sw_thumbnails 'product-image-thumbnails'
  47.                 with
  48.                 {
  49.                     media: secondMedia,
  50.                     sizes: {
  51.                     'xs': '308px',
  52.                     'md': '420px',
  53.                     'xl': '868px'
  54.                 }
  55.                 } %}
  56.         {% endif %}
  57.     {% else %}
  58.         {% block component_product_box_image_placeholder %}
  59.             {% sw_icon 'placeholder' style {
  60.                 'size': 'fluid'
  61.             } %}
  62.         {% endblock %}
  63.     {% endif %}
  64. {% endblock %}
  65. {% block component_product_box_variant_characteristics %}
  66. {% endblock %}
  67. {% block component_product_box_image_link %}
  68.     {{ parent() }}
  69.     <div class="variant-selector justify-center text-sm transition absolute bottom-0 flex w-full flex-wrap grid-gap-2 p-2 bg-white/25 opacity-0 group-hover:opacity-100">
  70.         {% for product in product.extensions.allChildren.elements %}
  71.             {% set size = product.options.elements|first.name %}
  72.             {% if product.availableStock %}
  73.                 <a href="{{ productUrl }}?size={{ size }}"
  74.                    title="Selecteer maat {{ size }}"
  75.                    class="flex items-center justify-center w-8 h-8 bg-grey-50 border border-transparent rounded-sm hover:border-grey-900">{{ size }}</a>
  76.             {% endif %}
  77.         {% endfor %}
  78.     </div>
  79. {% endblock %}
  80. {% block component_product_box_brand_name %}
  81.     <div class="product-brand-name font-accent font-bold text-xs mb-2">
  82.         {{ product.manufacturer.translated.name }}
  83.     </div>
  84. {% endblock %}
  85. {% block component_product_box_name %}
  86.     <a href="{{ productUrl }}"
  87.        class="product-name block text-xs font-normal lg:text-sm"
  88.        title="{{ name }}">
  89.         {{ name }}
  90.     </a>
  91. {% endblock %}