themes/webapicTheme/templates/products/matching_products.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. <div class="listing1-product-ctn card">
  12.     {% include 'partials/block-add-to-wishlist.html.twig' with {'product': product} %}
  13.     <a href="{{ path('app_product_variant_show', {'slug': product.slug, 'id': product.id}) }}" class="{% if is_mobile() %}mobile {% else %}desktop{% endif %}">
  14.         
  15.         <div class="img-ctn">
  16.             <div class="flag">
  17.                 {% include 'partials/block-callout.html.twig' with {'callout': product.badge} only %}
  18.             </div>
  19.             <div class="img-ctn-content">
  20.         
  21.                 <img src="{{ path }}" id="main-image" alt="{{ product.name }}" {{ sylius_test_html_attribute('main-image') }} />
  22.                 {% set path = '' %}
  23.             
  24.                 {% if product.imagesByType('image_product_secondary') is not empty %}
  25.                     {% set source_path = product.imagesByType('image_product_secondary').first.path %}
  26.                     {% set path = source_path|imagine_filter('app_product_small_thumbnail_listing_cropped') %}
  27.                 {% elseif product.imagesByType('image_product_main') is not empty %}
  28.                     {% set source_path = product.imagesByType('image_product_main').first.path %}
  29.                     {% set path = source_path|imagine_filter('app_product_small_thumbnail_listing_cropped') %}
  30.                 {% endif %}
  31.                 {% if path is not empty %}
  32.                     <img class="hover" src="{{ path }}" id="main-image" alt="{{ product.name }}" {{ sylius_test_html_attribute('main-image') }} />      
  33.                 {% endif %}
  34.                 {% if is_mobile() and not is_device('iPad')  %}    
  35.                     <button class="mobile"><i class="chevron left icon"></i></button>
  36.                     <button class="mobile right"><i class="chevron right icon"></i></button>
  37.                 {% endif %}
  38.                 {% if not is_device('iPad')  %}    
  39.                     <div class="add">
  40.                         <button class="js-add-to-cart" data-url="{{ path('app_cart_add_to_cart_ajax') }}" data-postdata="{{ '{"' ~ product.id ~ '":1}' }}">
  41.                             <img src="{{ asset('webapic-theme/images/icon-panier.svg') }}" class="ui image" />
  42.                         </button>                                    
  43.                     </div>
  44.                 {% endif %}
  45.                 {# {% include '@SyliusShop/Product/Show/_addToCart.html.twig' with {'product': product}  %} #}
  46.             </div>     
  47.         </div>
  48.         <span class="title">{{ product.name }}</span>     
  49.         {% set price = money.calculatePrice(product) %}
  50.         {% set originalPrice = money.calculateOriginalPrice(product) %}
  51.         {# {% if price != originalPrice %}
  52.             <div class="sylius-product-original-price price" {{ sylius_test_html_attribute('product-original-price') }}><del>{{ originalPrice }}</del></div>
  53.         {% endif %} #}
  54.         <div class="sylius-product-price price"  {{ sylius_test_html_attribute('product-price') }}>{{ price }}</div>
  55.             
  56.     </a>
  57. </div>