custom/plugins/ZeobvBundleProducts/src/Resources/views/zeobv-bundle-products/components/bundle-product-info.html.twig line 1

Open in your IDE?
  1. {% block zeobv_bundle_products_components_bundle_product_info %}
  2.     {% if products %}
  3.         {{ "zeobv-bundle-products.detail.tableHeaderText"|trans|sw_sanitize }}
  4.         {% set showAvailabilityColumn = config('ZeobvBundleProducts.config.showBundleProductItemAvailabilityColumn') %}
  5.         {% set showThumbnail = config('ZeobvBundleProducts.config.showBundleProductItemThumbnailColumn') %}
  6.         {% set showManufacturer = config('ZeobvBundleProducts.config.showBundleProductItemManufacturer') %}
  7.         {% set showBundleProductNumber = config('ZeobvBundleProducts.config.showBundleProductNumber') %}
  8.         <table class="table product-bundle-products-table">
  9.             {% block page_product_detail_price_block_table_head %}
  10.                 <thead class="product-bundle-products-head">
  11.                 {% block page_product_detail_price_block_table_head_inner %}
  12.                     <tr class="product-bundle-products-header-row">
  13.                         {% block zeobv_bundle_products_components_bundle_product_info_table_header_cell_name %}
  14.                             <th scope="col"
  15.                                 class="product-bundle-products-product-cell product-bundle-products-product-name-cell"
  16.                                 colspan="{{ showThumbnail ? "2" : 1 }}">
  17.                                 {{ "zeobv-bundle-products.detail.dataColumnName"|trans|sw_sanitize }}
  18.                             </th>
  19.                         {% endblock %}
  20.                         {% block zeobv_bundle_products_components_bundle_product_info_table_header_cell_quantity %}
  21.                             <th scope="col"
  22.                                 class="product-bundle-products-product-cell product-bundle-products-product-quantity-cell">
  23.                                 {{ "zeobv-bundle-products.detail.dataColumnQuantity"|trans|sw_sanitize }}
  24.                             </th>
  25.                         {% endblock %}
  26.                         {% block zeobv_bundle_products_components_bundle_product_info_table_header_cell_available %}
  27.                             {% if showAvailabilityColumn %}
  28.                                 <th scope="col"
  29.                                     class="product-bundle-products-product-cell product-bundle-products-product-available-cell">
  30.                                     {{ "zeobv-bundle-products.detail.dataColumnAvailable"|trans|sw_sanitize }}
  31.                                 </th>
  32.                             {% endif %}
  33.                         {% endblock %}
  34.                         {% block zeobv_bundle_products_components_bundle_product_info_table_header_cell_price %}
  35.                             {% if showPrices %}
  36.                                 <th scope="col"
  37.                                     class="product-bundle-products-product-cell product-bundle-products-product-price-cell">
  38.                                     {{ "zeobv-bundle-products.detail.dataColumnPrice"|trans|sw_sanitize }}
  39.                                 </th>
  40.                             {% endif %}
  41.                         {% endblock %}
  42.                     </tr>
  43.                 {% endblock %}
  44.                 </thead>
  45.             {% endblock %}
  46.             {% block zeobv_bundle_products_components_bundle_product_info_table_body %}
  47.                 <tbody class="product-bundle-products-body">
  48.                 {% block zeobv_bundle_products_components_bundle_product_info_table_body_inner %}
  49.                     {% set total = 0 %}
  50.                     {% set mediaIds = products|map(product => product.cover ? product.cover.mediaId : null) %}
  51.                     {% set mediaCollection = searchMedia(mediaIds, context.context) %}
  52.                     {% for product in products|sort((a, b) => a.extensions.zeobvProductBundleConnection.position - b.extensions.zeobvProductBundleConnection.position) %}
  53.                         {% set quantity = product.extensions.zeobvProductBundleConnection.quantity %}
  54.                         {% set comment = product.extensions.zeobvProductBundleConnection.comment %}
  55.                         {% set price = product.calculatedPrice %}
  56.                         {% if product.calculatedPrices|length > 0 %}
  57.                             {% set price = product.calculatedPrices|filter((calculatedPrice) => calculatedPrice.quantity <= quantity)|last %}
  58.                             
  59.                             {% if not price %}
  60.                                 {% for advancePrice in product.prices %}
  61.                                     {% if advancePrice.quantityStart <= quantity and advancePrice.quantityEnd >= quantity %}
  62.                                         {% set price = product.calculatedPrices|filter(
  63.                                             (calculatedPrice) => calculatedPrice.quantity <= advancePrice.quantityEnd
  64.                                         )|last %}
  65.                                     {% endif %}
  66.                                 {% endfor %}
  67.                             {% endif %}
  68.                         {% endif %}
  69.                         {% if quantity > 1 %}
  70.                             {% set price = quantity * price.unitPrice %}
  71.                         {% else %}
  72.                             {% set price = price.unitPrice %}
  73.                         {% endif %}
  74.                         {% set total = total + price %}
  75.                         <tr class="product-bundle-products-product-row">
  76.                             {% block zeobv_bundle_products_components_bundle_product_info_table_body_cell_thumb %}
  77.                                 {% if showThumbnail %}
  78.                                     <td scope="row"
  79.                                         class="product-bundle-products-product-cell product-bundle-products-cell-thin product-bundle-products-product-cell-thumbnail">
  80.                                         {% set productCover = mediaCollection.get(product.cover.mediaId) %}
  81.                                         {% sw_thumbnails 'minimal-image-thumbnails' with {
  82.                                             media: productCover,
  83.                                             sizes: {
  84.                                                 'default': '20px'
  85.                                             },
  86.                                             attributes: {
  87.                                                 'class': 'img-fluid quickview-minimal-img',
  88.                                                 'alt': ( product.cover.translated.alt ?: ''),
  89.                                                 'title': (product.cover.translated.title ?: '')
  90.                                             }
  91.                                         } %}
  92.                                     </td>
  93.                                 {% endif %}
  94.                             {% endblock %}
  95.                             {% block zeobv_bundle_products_components_bundle_product_info_table_body_cell_name %}
  96.                                 <td scope="row"
  97.                                     class="product-bundle-products-product-cell product-bundle-products-cell-thin">
  98.                                     {% set visibilityResult = product.visibilities.elements |first %}
  99.                                     {% if product.available and product.active and visibilityResult.visibility != "10" %}
  100.                                         <a href="{{ seoUrl('frontend.detail.page', {productId: product.id}) }}">
  101.                                             {{ product.translated.name }} {% if comment %} | {{ comment }} {% endif %}
  102.                                         </a>
  103.                                     {% else %}
  104.                                         {{ product.translated.name }} {% if comment %} | {{ comment }} {% endif %}
  105.                                     {% endif %}
  106.                                     <div class="sub-text">
  107.                                         {% if showManufacturer and product.manufacturer.name %}
  108.                                             <span class="manufacturer-name">{{ product.manufacturer.name }}</span>
  109.                                         {% endif %}
  110.                                         {% if showBundleProductNumber and product.productNumber %}
  111.                                             <span class="product-number">{{ product.productNumber }}</span>
  112.                                         {% endif %}
  113.                                     </div>
  114.                                 </td>
  115.                             {% endblock %}
  116.                             {% block zeobv_bundle_products_components_bundle_product_info_table_body_cell_quantity %}
  117.                                 <td class="product-bundle-products-product-cell product-bundle-products-cell-thin product-bundle-products-product-cell-qty">
  118.                                     {{ quantity }}
  119.                                 </td>
  120.                             {% endblock %}
  121.                             {% block zeobv_bundle_products_components_bundle_product_info_table_body_cell_available %}
  122.                                 {% if showAvailabilityColumn %}
  123.                                     <td class="product-bundle-products-product-cell product-bundle-products-product-cell-available">
  124.                                         {% if product.available %}
  125.                                             {% sw_icon 'checkmark' style { 'size': 'sm' } %}
  126.                                         {% else %}
  127.                                             {% sw_icon 'x' style { 'size': 'sm' } %}
  128.                                         {% endif %}
  129.                                     </td>
  130.                                 {% endif %}
  131.                             {% endblock %}
  132.                             {% block zeobv_bundle_products_components_bundle_product_info_table_body_cell_price %}
  133.                                 {% if showPrices %}
  134.                                     <td class="product-bundle-products-product-cell product-bundle-products-product-cell-price">
  135.                                         {{ price|currency }}
  136.                                     </td>
  137.                                 {% endif %}
  138.                             {% endblock %}
  139.                         </tr>
  140.                     {% endfor %}
  141.                     {% block zeobv_bundle_products_components_bundle_product_info_table_footer %}
  142.                         {% if showPrices and showTotalPrice %}
  143.                             <tr class="product-bundle-products-total-row">
  144.                                 {% block zeobv_bundle_products_components_bundle_product_info_table_body_cell_total_label %}
  145.                                     <th scope="row"
  146.                                         colspan="{{ showThumbnail and showAvailabilityColumn ? 4 : (showThumbnail or showAvailabilityColumn ? 3 : 2) }}"
  147.                                         class="product-bundle-products-product-cell product-bundle-total-cell">
  148.                                     <span class="product-bundle-total-label">
  149.                                         {{ "zeobv-bundle-products.detail.dataColumnTotal"|trans|sw_sanitize }}
  150.                                     </span>
  151.                                     </th>
  152.                                 {% endblock %}
  153.                                 {% block zeobv_bundle_products_components_bundle_product_info_table_body_cell_total_price %}
  154.                                     <td class="product-bundle-products-product-cell product-bundle-products-product-cell-total">
  155.                                         <span>{{ total|currency }}</span>
  156.                                     </td>
  157.                                 {% endblock %}
  158.                             </tr>
  159.                         {% endif %}
  160.                     {% endblock %}
  161.                 {% endblock %}
  162.                 </tbody>
  163.             {% endblock %}
  164.         </table>
  165.     {% endif %}
  166. {% endblock %}