custom/plugins/theme/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. {# add lazy load and hover img #}
  3. {% block component_product_box_image_link_inner %}
  4.     {% if cover.url %}
  5.         {% set hoverImg = false %}
  6.         {% set hoverImgSrc = '' %}
  7.         {% if product.customFields.doncarne_product_custom_fields_listing_hover_img %}
  8.             {% set hoverImgId = product.customFields.doncarne_product_custom_fields_listing_hover_img %}
  9.             {% if context.context is defined %}
  10.                 {% set mediaCollection = searchMedia([hoverImgId], context.context) %}
  11.                 {% set media = mediaCollection.get(hoverImgId) %}
  12.             {% elseif context is defined %}
  13.                 {% set mediaCollection = searchMedia([hoverImgId], context) %}
  14.                 {% set media = mediaCollection.get(hoverImgId) %}
  15.             {% else %}
  16.                 {% for mediaItem in product.media %}
  17.                     {% if mediaItem.media.id == hoverImgId %}
  18.                         {% set media = mediaItem.media %}
  19.                     {% endif %}
  20.                 {% endfor %}
  21.             {% endif %}
  22.             
  23.             {% if media and media.url %}
  24.                 {% set hoverImgSrc = media.url %}
  25.                 {% set hoverImg = true %}
  26.             {% endif %}
  27.         {% endif %}
  28.         {% set attributes = {
  29.             'class': 'product-image is-'~displayMode,
  30.             'alt': (cover.translated.alt ?: name),
  31.             'title': (cover.translated.title ?: name),
  32.             'loading': 'lazy',
  33.             'data-hover-img': hoverImg ? '1' : '0',
  34.             'data-hover-img-source': hoverImgSrc
  35.         } %}
  36.         {% if displayMode == 'cover' or displayMode == 'contain' %}
  37.             {% set attributes = attributes|merge({ 'data-object-fit': displayMode }) %}
  38.         {% endif %}
  39.         {% block component_product_box_image_thumbnail %}
  40.            {{ parent() }}
  41.         {% endblock %}
  42.     {% else %}
  43.         {% block component_product_box_image_placeholder %}
  44.             <div class="product-image-placeholder product-image is-standard">
  45.                 {% sw_icon 'placeholder' style {
  46.                     'size': 'fluid'
  47.                 } %}
  48.             </div>
  49.         {% endblock %}
  50.     {% endif %}
  51. {% endblock %}
  52. {% block component_product_box_wishlist_action %}
  53.     {# Wishlist Button wurde in den card-body verschoben - dieser Block bleibt leer #}
  54. {% endblock %}
  55. {% block component_product_box_info %}
  56.     {# Add product number reference -- used in app/storefront/src/js/product-listing-rating.plugin.js && controller url #}
  57.     <div class="product-info">
  58.         {% block component_product_box_name %}
  59.             {{ parent() }}
  60.             <a
  61.                 data-rating-url="{{ path('frontend.product.rating', {'productNumber': product.productNumber }) }}"
  62.                 href="{{ seoUrl('frontend.detail.page', {'productId': product.id}) }}#review-tab-pane"
  63.             ></a>
  64.             {% if product.getExtension("doncarneCutProperties").all()|first %}
  65.                 {% sw_include '@Storefront/solution360/cut-product-property-image.html.twig' with {media: product.getExtension("doncarneCutProperties").all()|first.media} only %}
  66.             {% endif %}
  67.             <span class="product-unit-label">
  68.                 {% if product.purchaseUnit %}
  69.                     {{ "listing.boxUnitLabel"|trans|sw_sanitize }} {{product.purchaseUnit}} {{product.unit.translated.name}}
  70.                 {% endif %}
  71.                 {% if product.translated.packUnit %}
  72.                     {% if product.purchaseUnit %}, {% endif %}{{product.translated.packUnit}}
  73.                 {% endif %}
  74.             </span>
  75.         {% endblock %}
  76.         {% block component_product_box_rating %}
  77.             {% if config('core.listing.showReview') %}
  78.                 <div class="product-rating">
  79.                     {% if true or product.ratingAverage %}
  80.                         {% sw_include '@Storefront/storefront/component/review/rating.html.twig' with {
  81.                             points: product.ratingAverage,
  82.                             style: 'text-primary'
  83.                         } %}
  84.                         <span class="point-rating__details">{{product.ratingAverage}}/5.00</span>
  85.                     {% endif %}
  86.                 </div>
  87.             {% endif %}
  88.         {% endblock %}
  89.         {% block component_product_box_variant_characteristics %}
  90.             {% sw_include '@Storefront/solution360/product-usps-listing.html.twig' with { product: product }%}
  91.         {% endblock %}
  92.         {% block component_product_box_description %}
  93.         {% endblock %}
  94.         <div class="product-price-wishlist-wrapper">
  95.             {% block component_product_box_price %}
  96.                 {{ parent() }}
  97.             {% endblock %}
  98.             {# Wishlist Button neben dem Preis #}
  99.             {% block component_product_box_wishlist_action_inline %}
  100.                 {# CoeWishlistSw6 Plugin #}
  101.                 {% if config('CoeWishlistSw6.config.wishlistButtonOnListing') %}
  102.                     {% sw_include '@Storefront/storefront/component/wishlist/button/add-note.html.twig'
  103.                         with {
  104.                             additionalClass: 'product-card__wishlist-btn wishlist-inline'
  105.                         }
  106.                     %}
  107.                 {# Standard Shopware Wishlist #}
  108.                 {% elseif config('core.cart.wishlistEnabled') %}
  109.                     {% if controllerName !== "Wishlist" %}
  110.                         {% sw_include '@Storefront/storefront/component/product/card/wishlist.html.twig' with {
  111.                             appearance: 'circle',
  112.                             productId: id,
  113.                             additionalClass: 'wishlist-inline'
  114.                         } %}
  115.                     {% else %}
  116.                         {# on wishlist page: show remove button #}
  117.                         <div class="product-wishlist product-wishlist-remove wishlist-inline">
  118.                             {% block component_product_wishlist_remove_form_inline %}
  119.                                 {% set size = size ?? 'md' %}
  120.                                 <form action="{{ path('frontend.wishlist.product.delete', {'id': id}) }}"
  121.                                         method="post"
  122.                                         class="product-wishlist-form"
  123.                                         data-form-csrf-handler="true">
  124.                                     {% block component_product_box_wishlist_remove_csrf_inline %}
  125.                                         {{ sw_csrf('frontend.wishlist.product.delete') }}
  126.                                     {% endblock %}
  127.                                     {% block component_product_wishlist_remove_redirect_inline %}
  128.                                         <input type="hidden"
  129.                                                 name="redirectTo"
  130.                                                 value="frontend.wishlist.page"/>
  131.                                     {% endblock %}
  132.                                     {% block component_product_wishlist_remove_submit_inline %}
  133.                                         <button type="submit" class="btn product-wishlist-btn product-wishlist-btn-remove">
  134.                                             {% sw_icon 'x' style { 'class': 'icon-wishlist icon-wishlist-remove', 'size': size, 'pack': 'solid' } %}
  135.                                         </button>
  136.                                     {% endblock %}
  137.                                 </form>
  138.                             {% endblock %}
  139.                         </div>
  140.                     {% endif %}
  141.                 {% endif %}
  142.             {% endblock %}
  143.         </div>
  144.         {# % sw_include '@Storefront/solution360/special-product-properties.html.twig' with {specialProperties: product.getExtension("doncarneSpecialProperties").all()} % #}
  145.         {% block component_product_box_action %}
  146.         {% endblock %}
  147.     </div>
  148. {% endblock %}