templates/default/components/organisms/econda-slider/econda-slider.html.twig line 1

Open in your IDE?
  1. {% set categoryId = app.request.get('category').id|default %}
  2. <div class="econda-slider econda-slider--hide {{ class|default }}" data-econda-identifer="{{ econdaContentIdentifier|default(_uid|default) }}">
  3. {% set product = {
  4. 'name': '[[record.name]]',
  5. 'master': {
  6. 'displaySku': '[[record.id]]',
  7. 'links': {
  8. 'webshop': '#[[record.deeplink]]'
  9. }
  10. }
  11. } %}
  12. {% set sliderProducts = [product] %}
  13. {% embed 'components/organisms/product-slider/product-slider.html.twig' with {
  14. 'attributes': {'data-is-econda': 'true'},
  15. }%}
  16. {% block sliderSlides %}
  17. <div class="product-slider__wrapper swiper-wrapper">
  18. <div class="product-slider__slider swiper-slide econda-template" data-imageservice-base-url="{{ imageservice }}">
  19. {% embed 'components/molecules/product-box/product-box.html.twig' with {
  20. 'class': ' product-box--slider',
  21. } %}
  22. {% block productBoxBadges %}
  23. <div class="product-box__badges ">
  24. {% include 'components/atoms/badge/badge.html.twig' with {
  25. 'class': 'badge--new badge--with-background econda-slider__new--hide',
  26. 'content': 'product_badge_new' | trans
  27. } %}
  28. {% include 'components/atoms/badge/badge.html.twig' with {
  29. 'class': 'badge--sale badge--with-background econda-slider__sale--hide',
  30. 'content': 'SALE'
  31. } %}
  32. </div>
  33. {% endblock %}
  34. {% block productBoxImage %}
  35. <div class="product-box__image-box">
  36. {% include 'components/atoms/image/image.html.twig' with {
  37. 'class': 'product-box__image product_ssss',
  38. 'strict': true,
  39. 'lazyload': true
  40. } %}
  41. </div>
  42. {% endblock %}
  43. {% block productBoxTextBadge %}
  44. <div class="product-box__text-badge">
  45. {% include 'components/atoms/badge/badge.html.twig' with {
  46. 'class': 'badge--text econda-slider__bestseller--hide',
  47. 'content': 'bestseller'|trans
  48. } %}
  49. </div>
  50. {% endblock %}
  51. {% block productBoxTitle %}
  52. <div class="product-box__title">
  53. <span>[[record.name]]</span>
  54. </div>
  55. {% endblock %}
  56. {% block productBoxPrices %}
  57. <div class="product-box__price">
  58. <div class="econda-slider__price econda-slider__price--hide">
  59. <span class="econda-slider__action-price--hide econda-slider__action-price" data-layer-price="[[record.price]]" data-layer-currency="{{ 0|currencyCode }}">
  60. [[record.actionPrice]]
  61. </span>
  62. <span class="econda-slider__price--old econda-slider__action-price--hide">
  63. [[record.price]]
  64. </span>
  65. <span class="econda-slider__normal-price--hide">
  66. [[record.price]]
  67. </span>
  68. <span class="econda-slider__price-tax">
  69. {{ app.request.attributes.getBoolean('exclude_vat') ? 'header_vat_excluding'|trans : 'header_vat_including'|trans }}
  70. </span>
  71. </div>
  72. <span class="product-box__price-on-request econda-slider__price-on-request--hide" >{{'price_on_request'|trans}}</span>
  73. {% block productBoxAction %}
  74. <div class="econda-slider__shopping-list-icon--hide">
  75. <a class="js-add-to-shopping-list"
  76. href="#"
  77. aria-label="{{ 'shopping_list_add'|trans }}"
  78. data-product-id="[[record.productId]]"
  79. data-variant-id="[[record.variantId]]"
  80. data-shopping-list-icon=""
  81. data-shopping-list-success-icon="icon--pin-fill" >
  82. <i class="icon icon--pin"></i>
  83. </a>
  84. </div>
  85. {% endblock%}
  86. </div>
  87. {% endblock %}
  88. {% endembed %}
  89. </div>
  90. </div>
  91. {% endblock %}
  92. {% endembed %}
  93. </div>
  94. <script data-cookie-type="econda-slider" type="application/javascript">
  95. window.econda.ready(() => {
  96. if (typeof econdaConfig !== 'undefined') {
  97. econdaConfig.crosssellAccountId = "{{ 'econda_account_id'|trans }}";
  98. let econdaElement = document.querySelector('[data-econda-identifer="{{ econdaContentIdentifier|default(_uid|default) }}"]');
  99. if (econdaElement != null) {
  100. let econdaSlider = econdaElement.querySelector('.product-slider__wrapper');
  101. const widget = new econda.recengine.Widget({
  102. element: econdaSlider,
  103. renderer: {
  104. type: 'function',
  105. rendererFn: window.dataStore.econdaTemplate
  106. },
  107. afterRender: window.dataStore.econdaAfterRender,
  108. id : {{ widgetId|default(1) }},
  109. removeIfEmpty: true,
  110. emptyThreshold: 1,
  111. context: {
  112. {% if econdaProductId is defined %}
  113. {% if econdaProductId is iterable %}
  114. products: [
  115. {% for product in econdaProductId %}
  116. {id: '{{ product.sku }}'+'W' },
  117. {% endfor %}
  118. ],
  119. {% else %}
  120. products: [{id: "{{ econdaProductId }}" }],
  121. {% endif %}
  122. {% endif %}
  123. {% if categoryId is defined and categoryId is not empty %}
  124. categories:{
  125. type: 'productcategory',
  126. id: '{{ categoryId }}'
  127. }
  128. {% endif %}
  129. },
  130. });
  131. widget.econdaElement = econdaElement;
  132. widget.render();
  133. econdaElement.removeAttribute('data-econda-identifer');
  134. }
  135. };
  136. });
  137. </script>