templates/front/product/product_card_list.html.twig line 1

Open in your IDE?
  1. {% block stylesheets %}
  2.     {{ encore_entry_link_tags('react/partials/wishlist') }}
  3. {% endblock %}
  4. {% block javascripts %}
  5.     {{ encore_entry_script_tags('react/partials/wishlist') }}
  6.     {{ encore_entry_script_tags('empathy') }}
  7. {% endblock %}
  8. {% set translations = {
  9.     "wishlist_popup.title": ('wishlist_popup.title'|trans),
  10.     "wishlist_popup.details": ('wishlist_popup.details'|trans),
  11.     "wishlist_popup.button_cancel": ('wishlist_popup.button_cancel'|trans),
  12.     "wishlist_popup.button_save": ('wishlist_popup.button_save'|trans),
  13.     "wishlist_popup.create_list": ('wishlist_popup.create_list'|trans),
  14.     "wishlist_popup.name_list": ('wishlist_popup.name_list'|trans),
  15.     "wishlist_popup.name_list_placeholder": ('wishlist_popup.name_list_placeholder'|trans),
  16.     "wishlist_popup.select_placeholder": ('wishlist_popup.select_placeholder'|trans),
  17.     "wishlist_popup.required_field": ('wishlist_popup.required_field'|trans),
  18.     "wishlist_popup.save_changes_ok": ('wishlist_popup.save_changes_ok'|trans),
  19.     "wishlist_popup.list_validation_name": ('wishlist_popup.list_validation_name'|trans),
  20.     "wishlist_popup.list_validation_duplicated": ('wishlist_popup.list_validation_duplicated'|trans),
  21.     "wishlist_popup.list_validation_alphanumeric": ('wishlist_popup.list_validation_alphanumeric'|trans),
  22.     "wishlist_popup.list_validation_max_list": ('wishlist_popup.list_validation_max_list'|trans),
  23. } %}
  24. <div id="empathy" data-layout="{{ layout|json_encode }}" data-iso-code="{{ app.session.get('lang') }}" data-session-id="{{ app.session.getId() }}" ></div>
  25. <div id="wishlist-translations" data-translations="{{ translations|json_encode }}"> </div>
  26. {% for product in parameters.products %}
  27.     <div class="productList-item">
  28.         {% set classStock = '' %}
  29.         {% if app.session.get('is_wholesaler') ==  app.session.get('customerGroup') %}
  30.             {% if  product.quantity <= 0 %}
  31.                 {% set classStock = ((product.quantity_venideros > 0) or (product.quantity_supplier_to_show > 0) )  ? 'productCard--soon' : 'productCard--noStock' %}
  32.             {% else %}
  33.                 {% set classStock = (product.quantity > 0)  ? 'productCard--soon' : 'productCard--noStock' %}
  34.             {% endif %}
  35.         {% endif %}
  36.         <article data-js-product-card="product-card" data-js-idProduct="{{ product.id_product }}"
  37.                  data-js-idAttribute="0"
  38.                  data-js-ga-reference="{{ product.reference[0] }}" data-js-ga-name="{{ product.name }}"
  39.                  data-js-ga-category="0" data-js-ga-list="Categoria" class="productCard productCard--shoppable {{ product.ribbon_class }}">
  40.             <figure class="productCard-content">
  41.                 {% if app.session.get('id_customer') == true %}
  42.                     <div 
  43.                         id="bb-wishlist-{{loop.index}}"
  44.                         class="bb-wishlist-counter"
  45.                         data-product="{{ product|json_encode }}" 
  46.                     >
  47.                     </div>
  48.                 {% endif %}
  49.                 <a class="productCard-link productCard-imgCont productCard-imgCont--threeImgs"
  50.                    href="{{ base_url }}{{ app.session.get('lang') }}/{{ product.link_rewrite }}.html"
  51.                    onClick="window.productCardEmpathy('{{ product.name|raw }}', {{ product.id }}, '{{ base_url }}{{ app.session.get('lang') }}/{{ product.link_rewrite }}.html')"
  52.                    {% if product.translations == false %}rel="nofollow"{% endif %}>
  53.                     {% set typeImage = (product.is_gif) ? '.gif' : '.jpg' %}
  54.                      <img data-js-product-card-imgtodetail="imgtodetail"
  55.                      class="productCard-img {% if product.name_image != false %}lazy{% else %}u-hide{% endif %}"
  56.                      src="{{ base_url_img }}public/img/Loading.gif"
  57.                      data-original="{{ base_url }}{{ product.id_image }}-home/{{ product.name_image }}{{ typeImage }}"
  58.                      alt="{{ product.name|raw }}" title="{{ product.name|raw }}">
  59.                     
  60.                 </a>
  61.                 <figcaption class="productCard-properties">
  62.                     <div class="productCard-title">
  63.                         <a data-js-product-card-atodetail="atodetail" class="productCard-link"
  64.                            onClick="window.productCardEmpathy('{{ product.name|raw }}', {{ product.id }}, '{{ base_url }}{{ app.session.get('lang') }}/{{ product.link_rewrite }}.html')"
  65.                            href="{{ base_url }}{{ app.session.get('lang') }}/{{ product.link_rewrite }}.html"
  66.                            title="{{ product.name|raw }}"
  67.                            {% if product.translations == false %}rel="nofollow"{% endif %}>{{ product.name }}</a>
  68.                         {% if app.session.get('is_wholesaler') %}
  69.                             <aside class="productCard-sizes">
  70.                                 <div class="productCard-sizesItem">
  71.                                     <svg role="img" class="icon icon--inline icon--xs">
  72.                                         <use xmlns:xlink="http://www.w3.org/1999/xlink"
  73.                                              xlink:href="{{ base_url }}public/img/icons/svg-defs.svg#icon-bbcode"></use>
  74.                                     </svg>
  75.                                     {{ legacy_trans('Ref.', 'product-card-list') }} {{ product.reference|last }}</div>
  76.                                 <div class="productCard-sizesItem">
  77.                                     <svg role="img" class="icon icon--inline icon--xs">
  78.                                         <use xmlns:xlink="http://www.w3.org/1999/xlink"
  79.                                              xlink:href="{{ base_url }}public/img/icons/svg-defs.svg#icon-caja_alt"></use>
  80.                                     </svg>
  81.                                     {{ legacy_trans('Caja (uds.)', 'product-card-list') }}: {{ product.box }}</div>
  82.                                 <div class="productCard-sizesItem">
  83.                                     <svg role="img" class="icon icon--inline icon--xs">
  84.                                         <use xmlns:xlink="http://www.w3.org/1999/xlink"
  85.                                              xlink:href="{{ base_url }}public/img/icons/svg-defs.svg#icon-pallet3"></use>
  86.                                     </svg>
  87.                                     {{ legacy_trans('Pallet (uds.)', 'product-card-list') }}: {{ product.palet }}</div>
  88.                             </aside>
  89.                         {% endif %}
  90.                     </div>
  91.                     {% if app.session.get('is_wholesaler') %}
  92.          
  93.                         <div class="stockAvailability stockAvailability--vertical">
  94.                             <p class="stockAvailability-title stockAvailability-title--{{ product.quantity > 0 ? 'success' : 'error' }}">
  95.                                 {% if product.quantity <= 0 and product.quantity_future <= 0 and product.quantity_venideros <= 0 and (0 <= (product.quantity_supplier - product.quantity_extern)) %}
  96.                                     {{ legacy_trans('No disponible', 'product-card-list') }}
  97.                                 {% elseif product.quantity > 0 or  product.quantity_future > 0 %}
  98.                                     {{ legacy_trans('Disponible', 'product-card-list') }} ({{ product.quantity }})
  99.                                 {% else %}
  100.                                     {{ legacy_trans('Próximamente', 'product-card-list') }}
  101.                                 {% endif %}
  102.                             </p>
  103.                             <ul class="stockAvailability-list">
  104.                                 {% if product.quantity_immediate  > 0 %}
  105.                                     <li class="stockAvailability-item">
  106.                                         {{ 'stock.units_immediate' | trans({}, 'messages', app.session.get('lang')) | format(product.quantity_immediate) }}
  107.                                     </li>
  108.                                 {% endif %}
  109.                                 {% if product.quantity_supplier - product.quantity_extern > 0 %}
  110.                                     <li class="stockAvailability-item">
  111.                                         {{ 'stock.units_jit_24_48' | trans({}, 'messages', app.session.get('lang')) | format((product.quantity_supplier - product.quantity_extern)) }}
  112.                                     </li>
  113.                                 {% endif %}
  114.                                 {% if (product.quantity_supplier_2_5 - product.quantity_extern_2_5) > 0 %}
  115.                                     <li class="stockAvailability-item">
  116.                                         {{ 'stock.units_days' | trans({}, 'messages', app.session.get('lang')) | format(product.quantity_supplier_2_5 - product.quantity_extern_2_5, '2-5') }}
  117.                                     </li>
  118.                                 {% endif %}
  119.                                 {% if (product.quantity_future) > 0 %}
  120.                                     <li class="stockAvailability-item">
  121.                                         {{ 'stock.units_days' | trans({}, 'messages', app.session.get('lang')) | format(product.quantity_future, '5-30') }}
  122.                                     </li>
  123.                                 {% endif %}
  124.                             </ul>
  125.                         </div>
  126.                     {% endif %}
  127.                     <div class="productCard-prices">
  128.                         <div class="productCard-pvp productCard-pvp--now">
  129.                             <div class="productCard-pvp-name productCard-pvp--relevant">
  130.                                 {% if app.session.get('is_wholesaler') %}
  131.                                     {{ legacy_trans('PVD', 'product-card-list') }}
  132.                                 {% else %}
  133.                                     {{ legacy_trans('PVR', 'product-card-list') }}
  134.                                 {% endif %}
  135.                             </div>
  136.                             <div class="productCard-pvp-amount productCard-pvp--relevant">
  137.                                 {{ display_price(product.price_after) }}
  138.                             </div>
  139.                         </div>
  140.                         <div class="productCard-pvp productCard-pvp--before">
  141.                             <div class="productCard-pvp-name">
  142.                                 {% if app.session.get('is_wholesaler') %}
  143.                                     {{ legacy_trans('PVR', 'product-card-list') }}
  144.                                 {% else %}
  145.                                     {{ legacy_trans('PVP', 'product-card-list') }}
  146.                                 {% endif %}
  147.                             </div>
  148.                             <div class="productCard-pvp-amount  productCard-pvp-amount--before">
  149.                                 {{ display_price(product.price_before) }}
  150.                             </div>
  151.                         </div>
  152.                         <div class="productCard-pvp productCard-pvp--discount">
  153.                             -{{ product.descuento|number_format(0) }}%
  154.                         </div>
  155.                     </div>
  156.                     {% if app.session.get('is_wholesaler') %}
  157.                         <div class="productCard-prices productCard-prices--alt">
  158.                             <p class="productCard-priceitem">
  159.                             <span>
  160.                                 {{ legacy_trans('New', 'product-card-list') }}
  161.                                 {{ legacy_trans('PVD', 'product-card-list') }}
  162.                             </span>
  163.                                 <span>
  164.                                 {{ display_price(product.price_after) }}
  165.                             </span>
  166.                             </p>
  167.                             <p class="productCard-priceitem u-op-50">
  168.                             <span>
  169.                                 {{ legacy_trans('Old', 'product-card-list') }}
  170.                                 {{ legacy_trans('PVD', 'product-card-list') }}
  171.                             </span>
  172.                                 <strike>
  173.                                     {{ display_price(product.price_after_old) }}
  174.                                 </strike>
  175.                             </p>
  176.                             <p class="productCard-priceitem">
  177.                             <span>
  178.                                 {{ legacy_trans('New', 'product-card-list') }}
  179.                                 {{ legacy_trans('PVR', 'product-card-list') }}
  180.                             </span>
  181.                                 <span>
  182.                                 {{ display_price(product.price_before) }}
  183.                             </span>
  184.                             </p>
  185.                             <p class="productCard-priceitem u-op-50">
  186.                             <span>
  187.                                 {{ legacy_trans('Old', 'product-card-list') }}
  188.                                 {{ legacy_trans('PVR', 'product-card-list') }}
  189.                             </span>
  190.                                 <strike>
  191.                                     {{ display_price(product.price_before_old) }}
  192.                                 </strike>
  193.                             </p>
  194.                             <div class="productCard-discount">
  195.                                 -{{ product.descuento_old|number_format(0) }}%
  196.                             </div>
  197.                         </div>
  198.                     {% endif %}
  199.                 </figcaption>
  200.             </figure>
  201.             {% if product.ribbon_name != false %}
  202.                 {% set ribbon_name = product.ribbon_name %}
  203.                 {% if product.ribbon_name|upper == 'OPENBOX' %}
  204.                     {% set ribbon_name = 'Renewed' %}
  205.                 {% endif %}
  206.                 <div class="productCard-ribbon">
  207.                     {{ ribbon_name }}
  208.                 </div>
  209.             {% endif %}
  210.             {% if product.video != false %}
  211.                 <div class="productCard-play"></div>
  212.             {% endif %}
  213.             <div class="productCard-buy">
  214.                 {% if product.quantity_supplier_to_show > 0 and product.quantity <= 0 and app.session.get('is_wholesaler') %}
  215.                     <div class="productCard-caption">
  216.                         {{ legacy_trans('Bajo pedido', 'product-card-list') }}
  217.                     </div>
  218.                 {% elseif product.quantity_venideros > 0 and product.quantity <= 0 and app.session.get('is_wholesaler') %}
  219.                     <div class="productCard-caption">
  220.                         {{ legacy_trans('Próximamente', 'product-card-list') }}
  221.                     </div>
  222.                 {% elseif product.quantity <= 0 %}
  223.                     <div class="productCard-caption">
  224.                         {{ legacy_trans('Sin stock', 'product-card-list') }}
  225.                     </div>
  226.                 {% else %}
  227.                     <div data-js-product-card-container-addToCart class="productCard-caption">
  228.                         <div class="unitControl">
  229.                             <input data-js-product-card-unitcontrolinput="unitcontrolinput"
  230.                                    class="form-input form-input--postfix unitControl-input" type="text"
  231.                                    maxlength="10" value="1">
  232.                             <span class="form-postfix unitControl-groupBtns">
  233.                             <button data-js-product-card-unitcontrolplus="unitcontrolPlus"
  234.                                     class="button button--icon unitControl-button unitControl-button--plus"></button>
  235.                             <button data-js-product-card-unitcontrolminus="unitcontrolMinus"
  236.                                     class="button button--icon unitControl-button unitControl-button--minus"></button>
  237.                         </span>
  238.                         </div>
  239.                         {% if product.id_product_attribute is defined and product.id_product_attribute is not null or product.quantity_dif != 0 and app.session.get('is_wholesaler') %}
  240.                             <div class="productCard-action u-pdt--half">
  241.                                 <a data-js-product-card-options="options" class="productCard-link"
  242.                                    href="{{ base_url }}{{ app.session.get('lang') }}/{{ product.link_rewrite }}.html">
  243.                                     {{ legacy_trans('Opciones', 'product-card-list') }}
  244.                                     <i data-js-product-card-options="options"
  245.                                        class="form-action-icon productCard-action-icon fa fa-chevron-right"></i>
  246.                                 </a>
  247.                             </div>
  248.                         {% else %}
  249.                             {% if (
  250.                                 (
  251.                                 app.session.get('customerPack') == 0 or
  252.                                 (
  253.                                 app.session.get('customerDateCsv')|date("Y-m-d") < "now"|date("Y-m-d") and app.session.get('customerPack') >1
  254.                                 ) or
  255.                                 app.session.get('id_customer') == false
  256.                                 )
  257.                                 )
  258.                                 and product.only_pack %}
  259.                                 <button class="button productCard-ctaButton" disabled
  260.                                         title="{{ legacy_trans('Añadir al carrito', 'product-card-list') }}">
  261.                                     <svg role="img" class="icon icon--xs">
  262.                                         <use xlink:href="{{ base_url }}public/img/icons/svg-defs.svg#icon-cart"></use>
  263.                                     </svg>
  264.                                 </button>
  265.                             {% else %}
  266.                                 <button data-js-product-card-addToCart="addToCart"
  267.                                         class="button button--primary productCard-ctaButton"
  268.                                         title="{{ legacy_trans('Añadir al carrito', 'product-card-list') }}">
  269.                                     <svg role="img" class="icon icon--xs">
  270.                                         <use xlink:href="{{ base_url }}public/img/icons/svg-defs.svg#icon-cart"></use>
  271.                                     </svg>
  272.                                 </button>
  273.                             {% endif %}
  274.                         {% endif %}
  275.                     </div>
  276.                 {% endif %}
  277.             </div>
  278.         </article>
  279.     </div>
  280. {% endfor %}