themes/BootstrapChildTheme/SyliusShopBundle/views/Product/Show/_addToCart.html.twig line 1

Open in your IDE?
  1. {% set product = order_item.variant.product %}
  2. {% form_theme form '@SyliusShop/Form/theme.html.twig' %}
  3. {% import '@SyliusUi/Macro/flags.html.twig' as flag %}
  4. <div class="ui segment" id="sylius-product-selecting-variant" {{ sylius_test_html_attribute('product-selecting-variant') }}>
  5.     {{ sylius_template_event('sylius.shop.product.show.before_add_to_cart', {'product': product, 'order_item': order_item}) }}
  6.     {{ form_start(form, {'action': path('sylius_shop_ajax_cart_add_item', {'productId': product.id}), 'attr': {'id': 'sylius-product-adding-to-cart', 'class': 'ui loadable form', 'novalidate': 'novalidate', 'data-redirect': path(configuration.getRedirectRoute('summary'))}}) }}
  7.     {{ form_errors(form) }}
  8.     <div class="ui red label bottom pointing hidden sylius-validation-error" id="sylius-cart-validation-error" {{ sylius_test_html_attribute('cart-validation-error') }}></div>
  9.     {% if not product.simple %}
  10.         {% if product.variantSelectionMethodChoice %}
  11.             {% include '@SyliusShop/Product/Show/_variants.html.twig' %}
  12.         {% else %}
  13.             {% include '@SyliusShop/Product/Show/_options.html.twig' %}
  14.         {% endif %}
  15.     {% endif %}
  16.     {{ form_row(form.cartItem.quantity, sylius_test_form_attribute('quantity')) }}
  17.     {{ sylius_template_event('sylius.shop.product.show.add_to_cart_form', {'product': product, 'order_item': order_item, 'form': form}) }}
  18.     {% set taxon = product.mainTaxon %}
  19.     {% set showPrice = true %}
  20.     {% set taxonsToAvoid = ['subscription-packs', 'welcome-packs', 'default-packs'] %}
  21.     {% for taxonToAvoid in taxonsToAvoid %}
  22.         {% if taxonToAvoid in taxon.slug %}
  23.             {% set showPrice = false %}
  24.         {% endif %}
  25.     {% endfor %}
  26.     {% if showPrice == true %}
  27.         <div class="row">
  28.             <div class="col-4 col-md-6 col-lg-4 product-price" {{ sylius_test_html_attribute('product-price-content') }}>
  29.                 {% if not product.enabledVariants.empty() %}
  30.                     {% include '@SyliusShop/Product/Show/_price.html.twig' %}
  31.                 {% endif %}
  32.             </div>
  33.             {% if is_product_owned(product) is empty %}
  34.                 <div class="col-8 col-md-6 col-lg-6 fixed-add-to-cart"> <button type="submit" class="ui huge primary icon labeled button" {{ sylius_test_html_attribute('add-to-cart-button') }}>{{ 'sylius.ui.add_to_cart'|trans }}</button> </div>
  35.                 {% if product.mainTaxon is not null %}
  36.                     {% set taxon = product.mainTaxon %}
  37.                     {% if taxon.enabled %}
  38.                         {% if taxon.code in ['storyteller', 'headphones', 'satchel'] %}
  39.                             <div class="col-lg-10">
  40.                                 {% set promotions = get_promotions_text(product) %}
  41.                                 {% for promotion in promotions %}
  42.                                     <div class="product-frame red font-white font-weight-bold">
  43.                                         <div class="text-uppercase">
  44.                                             {% if promotion.name is defined %}
  45.                                                 {{ promotion.name }}
  46.                                             {% else %}
  47.                                                 {{ promotion.label }}
  48.                                             {% endif %}
  49.                                         </div>
  50.                                         <div>{{ promotion.description }}</div>
  51.                                     </div>
  52.                                 {% endfor %}
  53.                                 <div class="product-frame yellow font-blue text-uppercase font-weight-bold">
  54.                                     {{'sylius.pages.content.freeDeliveryFrance.title'|trans|raw }}
  55.                                 </div>
  56.                                 <div class="product-frame font-blue" style="text-transform:none;font-weight:700">
  57.                                     {{'sylius.pages.content.freeDeliveryFrance.france'|trans|raw }} {{ flag.fromCountryCode('fr') }}
  58.                                     {{'sylius.pages.content.freeDeliveryFrance.belgium'|trans|raw }} {{ flag.fromCountryCode('be') }}
  59.                                     {{'sylius.pages.content.freeDeliveryFrance.luxembourg'|trans|raw }} {{ flag.fromCountryCode('lu') }}
  60.                                 </div>
  61.                             </div>
  62.                         {% endif %}
  63.                     {% endif %}
  64.                 {% endif %}
  65.             {% endif %}
  66.         </div>
  67.     {% endif %}
  68.     {{ form_row(form._token) }}
  69.     {{ form_end(form, {'render_rest': false}) }}
  70. </div>