themes/BootstrapChildTheme/SyliusShopBundle/views/Product/_quickAddToCart.html.twig line 1

Open in your IDE?
  1. {% set product = order_item.variant.product %}
  2. {% set variant = order_item.variant %}
  3. {% set formId = 'sylius-product-adding-to-cart-' ~ product.id %}
  4. {% form_theme form '@SyliusShop/Form/theme.html.twig' %}
  5. {% if is_product_owned(product) is empty %}
  6.     <div class="addToCartButton mr-2">
  7.         {{ sylius_template_event('sylius.shop.product.show.before_add_to_cart', {'product': product, 'order_item': order_item}) }}
  8.         {{ form_start(form, {'action': path('sylius_shop_ajax_cart_add_item', {'productId': product.id}), 'attr': {'id': formId, 'class': 'ui loadable form', 'novalidate': 'novalidate', 'data-redirect': path(configuration.getRedirectRoute('summary'))}}) }}
  9.         {{ form_errors(form) }}
  10.         <div class="ui red label bottom pointing hidden sylius-validation-error" id="sylius-cart-validation-error" {{ sylius_test_html_attribute('cart-validation-error') }}></div>
  11. {#        {% if not product.simple %}#}
  12. {#            {% if product.variantSelectionMethodChoice %}#}
  13. {#                {% include '@SyliusShop/Product/Show/_variants.html.twig' %}#}
  14. {#            {% else %}#}
  15. {#                {% include '@SyliusShop/Product/Show/_options.html.twig' %}#}
  16. {#            {% endif %}#}
  17. {#        {% endif %}#}
  18.         {{ sylius_template_event('sylius.shop.product.show.add_to_cart_form', {'product': product, 'order_item': product|sylius_resolve_variant }) }}
  19.         {% if form._token is defined %}
  20.             {{ form_row(form._token) }}
  21.         {% endif %}
  22.         {{ form_end(form, {'render_rest': false}) }}
  23.         {% set price = variant.getChannelPricingForChannel(sylius.channel).price %}
  24.         {% if product.simple %}
  25.             <button class="ui primary button quick-add-to-cart" {{ sylius_test_html_attribute('add-cart-btn') }} data-form-id="{{ formId }}">
  26.                 <span class="d-block d-md-none"> {{ 'sylius.ui.add_to_cart'|trans }}</span>
  27.                 <img class="d-none d-md-block" src="{{ asset('assets/shop/img/addtocart.svg') }}" alt="Ajouter au panier" />
  28.             </button>
  29.         {% else %}
  30.             <a href="{{ path('sylius_shop_product_show', {'slug': product.slug}) }}" class="ui primary button see-more">
  31.                 <span class="d-none d-md-block">+</span>
  32.                 <span class="d-block d-md-none">{{ 'app.pages.blog.shop.article.see_more' | trans }}</span>
  33.             </a>
  34.         {% endif %}
  35.     </div>
  36. {% endif %}