themes/webapicTheme/templates/products/single_product_in_circle.html.twig line 1

Open in your IDE?
  1. {% import "@SyliusShop/Common/Macro/money.html.twig" as money %}
  2. {% if product.imagesByType('image_product_main') is not empty %}
  3.     {% set source_path = product.imagesByType('image_product_main').first.path %}
  4.     {% set path = source_path|imagine_filter('app_product_small_thumbnail_listing') %}
  5. {% elseif product.images.first %}
  6.     {% set source_path = product.images.first.path %}
  7.     {% set path = source_path|imagine_filter('app_product_small_thumbnail_listing') %}
  8. {% else %}
  9.     {% set path = asset('webapic-theme/images/icon-gmap.png') %}
  10. {% endif %}
  11. {% set price = money.calculatePrice(product) %}
  12. {% set originalPrice = money.calculateOriginalPrice(product) %}
  13. <div class="listing1-product-ctn card">
  14.     {% include 'partials/block-add-to-wishlist.html.twig' with {'product': product, 'price': price} %}
  15.     <a href="{{ path('app_product_variant_show', {'slug': product.slug, 'id': product.id}) }}" class="{% if is_mobile() %}mobile {% else %}desktop{% endif %}">
  16.         
  17.         <div class="img-ctn">
  18.             <div class="flag">
  19.                 {% include 'partials/block-callout.html.twig' with {'callout': product.badge} only %}
  20.                                 {# Octobre Rose #}
  21.                                 {# {{dump(product)}} #}
  22.                                 {# {% if product.optionValues|length > 0 and product.optionValues[0].code == "PL.RO.FU" %}
  23.                                     <img class="lazy oct-rose" src="{{ asset('webapic-theme/images/2024_oct-rose_ruban-listing.svg') }}" alt="Octobre Rose" />
  24.                                 {% else %}
  25.                                     {% include 'partials/block-callout.html.twig' with {'callout': product.badge} only %}
  26.                                 {% endif %} #}
  27.             </div>  
  28.             <div class="img-ctn-content">
  29.         
  30.                 <img class="lazyload" data-src="{{ path }}" id="main-image" alt="{{ product.name }}" {{ sylius_test_html_attribute('main-image') }} />
  31.                 {% set path = '' %}
  32.             
  33.                 {% if product.imagesByType('image_product_secondary') is not empty %}
  34.                     {% set source_path = product.imagesByType('image_product_secondary').first.path %}
  35.                     {% set path = source_path|imagine_filter('app_product_small_thumbnail_listing_cropped') %}
  36.                 {% elseif product.imagesByType('image_product_main') is not empty %}
  37.                     {% set source_path = product.imagesByType('image_product_main').first.path %}
  38.                     {% set path = source_path|imagine_filter('app_product_small_thumbnail_listing_cropped') %}
  39.                 {% endif %}
  40.                 {% if path is not empty %}
  41.                     <img class="hover lazyload" data-src="{{ path }}" id="main-image" alt="{{ product.name }}" {{ sylius_test_html_attribute('main-image') }} />      
  42.                 {% endif %}
  43.                  {% if is_mobile() and not is_device('iPad')  %} 
  44.                     <button class="mobile"><i class="chevron left icon"></i></button>
  45.                     <button class="mobile right"><i class="chevron right icon"></i></button>
  46.                 {% endif %}
  47.                 {% if not is_device('iPad')  %} 
  48.                     {% set cat = '' %}
  49.                     {% set cat2 = '' %}
  50.                     {% if  product.product.mainTaxon is not null and product.product.mainTaxon.parent is not null  %} 
  51.                         {% set cat = product.product.mainTaxon.name %}                   
  52.                         {% if product.product.mainTaxon.parent is not null  %} 
  53.                             {% set cat2 = product.product.mainTaxon.parent.name %}
  54.                             
  55.                         {% endif %}                              
  56.                     {% endif %}
  57.                     <div class="add">
  58.                     
  59.                         <button class="js-add-to-cart" data-url="{{ path('app_cart_add_to_cart_ajax') }}" data-postdata="{{ '{"' ~ product.id ~ '":1}' }}" 
  60.                          data-id="{{ product.id }}" data-name="{{ product.name }}" data-price="{{ price|replace({'€': '',',': '.'}) }}" data-cat="{{ cat }}" data-catdeux="{{ cat2 }}">
  61.                             <img src="{{ asset('webapic-theme/images/icon-panier.svg') }}" class="ui image addcart" />
  62.                             {# <img src="{{ asset('webapic-theme/images/loader-spinner.gif') }}" class="ui image loader" /> #}
  63.                             <div class="loader lds-roller-ctn">
  64.                                 <div class="lds-roller"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div>
  65.                             </div>
  66.                         </button>
  67.                     </div>
  68.                  {% endif %}
  69.             </div>
  70.         </div>
  71.         <div class="name">{{ product.name }}</div>     
  72.        
  73.         {# {% if price != originalPrice %}
  74.             <div class="sylius-product-original-price price" {{ sylius_test_html_attribute('product-original-price') }}><del>{{ originalPrice }}</del></div>
  75.         {% endif %} #}
  76.         <div class="sylius-product-price price {% if price != originalPrice %}bloc-price-promo{% endif %}"  {{ sylius_test_html_attribute('product-price') }}>
  77.          {# aa{{ price }}bb{{ originalPrice }} #}
  78.             {% if price != originalPrice %}
  79.                         
  80.                 <div class="ligne-promo">
  81.                 
  82.                     <span class="original-price">{{ originalPrice }}</span>
  83.                     {# {% if product.badge is not defined or product.badge != "low_price"  %} #}
  84.                         
  85.                         <span class="percentage">
  86.                             {{  app_percentage_promo(product|sylius_calculate_original_price({'channel': sylius.channel}), product|sylius_calculate_price({'channel': sylius.channel})) }}
  87.                         </span>
  88.                     {# {% endif %} #}
  89.   
  90.                 </div>
  91.             {% endif %}
  92.             {% if product.badge is defined and product.badge is not empty and product.badge == "low_price"  %}
  93.                 {% set pricebarre = money.convertAndFormat(product|sylius_calculate_original_price({'channel': sylius.channel}) * 2) %}
  94.                 <span class="original-price">{{ pricebarre }}</span>
  95.             {% endif %}
  96.             {% if product.product.conditioning == 'per_meter_each_0_5_meter' %}
  97.             {{ price }}/m
  98.             {% elseif product.product.conditioning == 'card_kdo_per_euros_each_10_euros' %}
  99.                 {{ 'app.front.listing.product.from'|trans }} 10€
  100.             {% else %}
  101.             {{ price }}
  102.             {% endif %}
  103.         </div>
  104.             
  105.     </a>
  106. </div>