templates/default/components/organisms/pdp-gallery/pdp-gallery.html.twig line 1

Open in your IDE?
  1. {% set videoKeys = ['CS_YOUTUBE_ID1', 'CS_YOUTUBE_ID2', 'CS_YOUTUBE_ID3', 'CS_YOUTUBE_ID4'] %}
  2. {% set videos = [] %}
  3. {% for key in videoKeys %}
  4. {% if key in variant.attributes|keys and variant.attributes[key] is not empty %}
  5. {% set videos = videos|merge([variant.attributes[key]]) %}
  6. {% endif %}
  7. {% endfor %}
  8. {% block productBoxBadges %}
  9. {% try %}
  10. {% set until = date(variant.attributes.CS_NEW_UNTIL) %}
  11. {% catch %}
  12. {% set until = date("yesterday") %}
  13. {% endcatch %}
  14. <div class="pdp-gallery__badges">
  15. {% if variant.attributes.CS_BADGE|default() %}
  16. {% include 'components/atoms/badge/badge.html.twig' with {
  17. 'class': 'badge--cs-badge badge--with-background badge--pdp',
  18. 'content': variant.attributes.CS_BADGE
  19. } %}
  20. {% elseif until > date("now")|default(false) %}
  21. {% include 'components/atoms/badge/badge.html.twig' with {
  22. 'class': 'badge--new badge--with-background badge--pdp',
  23. 'content': 'product_badge_new' | trans
  24. } %}
  25. {% endif %}
  26. {% if variant.attributes.discount is defined and variant.attributes.discount is not empty
  27. and variant.salesStatus|default == constant('App\\Constant\\SalesStatus::SALE_STATUS_SALEABLE')%}
  28. {% include 'components/atoms/badge/badge.html.twig' with {
  29. 'class': 'badge--sale badge--with-background badge--pdp',
  30. 'content': 'discount_value'|trans({'%value%': variant.attributes.discount})
  31. } %}
  32. {% endif %}
  33. </div>
  34. {% if variant.stampImages|default is not empty %}
  35. <div class="pdp-gallery__badges pdp-gallery__badges--stamp">
  36. {% include 'components/atoms/image/image.html.twig' with {
  37. 'src': variant.stampImages[0].uri,
  38. 'class': 'image--stamp',
  39. 'resize': false
  40. } %}
  41. </div>
  42. {% endif %}
  43. {% endblock %}
  44. {% set show360Viewer = variant.attributes.CS_360ER_Bilder|default == 1 %}
  45. {% set orbitvuSku = show360Viewer ? variant.sku|default : null %}
  46. {% include 'components/organisms/image-gallery/image-gallery.html.twig' with {
  47. 'images': variant.images,
  48. 'obitvuSku': orbitvuSku,
  49. 'options': {
  50. 'main': {
  51. 'class': 'image-slider--detail-main js-image-main-slider',
  52. 'showNavigation': false,
  53. 'showPagination': true,
  54. 'imageSize': 'medium',
  55. 'showImageSimilarFlag': true,
  56. 'showVideoPreview': true,
  57. 'showOrbitvuPreview': true,
  58. 'navigation': {
  59. 'nextEl': 'js-preview-main-next-btn',
  60. 'prevEl': 'js-preview-main-prev-btn'
  61. },
  62. 'attributes': {
  63. 'data-swiper': {
  64. 'spaceBetween': 2,
  65. 'slidesPerView': 1,
  66. 'pagination': {
  67. 'el': '.swiper-pagination',
  68. },
  69. 'navigation': {
  70. 'nextEl': '.js-preview-main-next-btn',
  71. 'prevEl': '.js-preview-main-prev-btn',
  72. },
  73. 'thumbs': {
  74. 'swiper': '.js-image-thumbnail-slider',
  75. },
  76. }|json_encode|e,
  77. 'data-swiper-thumbnail-slider': '.js-image-thumbnail-slider'
  78. }
  79. },
  80. 'thumbnails': {
  81. 'class': 'image-slider--thumbnails js-image-thumbnail-slider',
  82. 'imageSize': 'small',
  83. 'showNavigation': false,
  84. 'showVideoThumbnail': true,
  85. 'showOrbitvuThumbnail': true,
  86. 'attributes': {
  87. 'data-swiper': {
  88. 'slidesPerView': 'auto',
  89. 'spaceBetween': 5,
  90. 'slidesPerGroup': 1,
  91. 'watchSlidesProgress': true,
  92. }|json_encode|e,
  93. 'data-swiper-main-slider': '.js-image-main-slider',
  94. }
  95. }
  96. }
  97. } %}
  98. {% include 'components/organisms/image-gallery/image-gallery.html.twig' with {
  99. 'images': variant.images|default,
  100. 'obitvuSku': orbitvuSku,
  101. 'lightgallery': true,
  102. 'options': {
  103. 'main': {
  104. 'class': 'image-slider--lightgallery-main js-lightgallery-main-slider',
  105. 'showNavigation': false,
  106. 'showImageSimilarFlag': true,
  107. 'attributes': {
  108. 'data-swiper': {
  109. 'init': false,
  110. 'slidesPerView': 1,
  111. 'lazy': true,
  112. 'thumbs': {
  113. 'swiper': '.js-lightgallery-thumbnail-slider',
  114. },
  115. }|json_encode|e,
  116. 'data-swiper-thumbnail-slider': '.js-lightgallery-thumbnail-slider'
  117. }
  118. },
  119. 'thumbnails': {
  120. 'class': 'image-slider--lightgallery-thumbnails js-lightgallery-thumbnail-slider',
  121. 'imageSize': 'small',
  122. 'showNavigation': false,
  123. 'showVideoThumbnail': true,
  124. 'showOrbitvuThumbnail': true,
  125. 'navigation': {
  126. 'nextEl': 'js-main-thumbnail-next-btn',
  127. 'prevEl': 'js-main-thumbnail-prev-btn'
  128. },
  129. 'attributes': {
  130. 'data-swiper': {
  131. 'slidesPerView': 'auto',
  132. 'spaceBetween': 15,
  133. 'lazy': true,
  134. 'watchSlidesVisibility': true,
  135. 'navigation': {
  136. 'nextEl': '.js-main-thumbnail-next-btn',
  137. 'prevEl': '.js-main-thumbnail-prev-btn',
  138. },
  139. }|json_encode|e,
  140. 'data-swiper-main-slider': '.js-lightgallery-main-slider'
  141. }
  142. }
  143. }
  144. } %}
  145. {% set additionalTextKey = 'additional_product_image_text' %}
  146. {% set additionalText = additionalTextKey|trans %}
  147. {% if additionalText not in ['', additionalTextKey] %}
  148. <span class="pdp-gallery__text">
  149. {{ additionalText }}
  150. </span>
  151. {% endif %}