themes/BootstrapChildTheme/SyliusShopBundle/views/Product/Show/_images.html.twig line 1

Open in your IDE?
  1. {% set hasMain = false %}
  2. {% if product.imagesByType('main') is not empty %}
  3.     {% set hasMain = true %}
  4.     {% set source_path = product.imagesByType('main').first.path %}
  5.     {% set original_path = source_path|imagine_filter('sylius_shop_product_original') %}
  6.     {% set path = source_path|imagine_filter(filter|default('app_shop_product_large_thumbnail')) %}
  7. {% elseif product.images.first %}
  8.     {% set source_path = product.images.first.path %}
  9.     {% set original_path = source_path|imagine_filter('sylius_shop_product_original') %}
  10.     {% set path = source_path|imagine_filter(filter|default('app_shop_product_large_thumbnail')) %}
  11. {% else %}
  12.     {% set original_path = 'https://via.placeholder.com/400x300' %}
  13.     {% set path = original_path %}
  14. {% endif %}
  15. <div class="gallery d-none d-lg-block">
  16.     <div class="row">
  17.         <div class="col {% if product.images|length > 1 %}col-md-9{% endif %}">
  18.             <a href="{{ original_path }}" class="image" data-lightbox="sylius-product-image">
  19.                 <img class="main-image" src="{{ path }}" alt="{{ product.name }}">
  20.             </a>
  21.         </div>
  22.         {% if product.images|length > 1 %}
  23.             <div class="col-md-3 ">
  24.                 {{ sylius_template_event('sylius.shop.product.show.before_thumbnails', {'product': product}) }}
  25.                 <div class="tiny-images">
  26.                     {% set count = 0 %}
  27.                     {% for image in product.images %}
  28.                         {% if (hasMain == true and image.type != 'main') or (hasMain == false and count > 0) %}
  29.                             {% set path = image.path is not null ? image.path|imagine_filter('sylius_shop_product_small_thumbnail') : '//placehold.it/200x200' %}
  30.                             <div class="tiny-image-box{% if count > 4 %} d-none{% endif %}">
  31.                                 {#{% if product.isConfigurable() and product.enabledVariants|length > 0 %}
  32.                                     {% include '@SyliusShop/Product/Show/_imageVariants.html.twig' %}
  33.                                 {% endif %}#}
  34.                                 <a class="tiny-link" href="{{ image.path|imagine_filter('sylius_shop_product_original') }}" data-lightbox="sylius-product-image">
  35.                                     <img class="tiny-image" src="{{ path }}" alt="{{ product.name }}">
  36.                                     {% if count > 5 %}<span class="tiny-others-images">+{{ product.images|length - 5 }}</span>{% endif %}
  37.                                 </a>
  38.                             </div>
  39.                         {% endif %}
  40.                         {% set count = count + 1 %}
  41.                     {% endfor %}
  42.                 </div>
  43.             </div>
  44.         {% endif %}
  45.     </div>
  46. </div>
  47. <div class="col-xs-10 offset-xs-1 col-sm-8 offset-sm-2">
  48.     <div class="splide d-lg-none mb-7">
  49.         <div class="splide__track">
  50.             <ul class="splide__list">
  51.                 {% for image in product.images %}
  52.                     <li class="splide__slide">
  53.                         <img class="splide-img" src="{{ image.path|imagine_filter('sylius_shop_product_original') }}" alt="{{ product.name }}">
  54.                     </li>
  55.                 {% endfor %}
  56.             </ul>
  57.         </div>
  58.     </div>
  59. </div>