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

Open in your IDE?
  1. {% import "@SyliusShop/Common/Macro/icons.html.twig" as icons %}
  2. {% form_theme form '@SyliusShop/Form/theme.html.twig' %}
  3. {% set product = order_item.variant.product %}
  4. {% set show_price = true %}
  5. {% set hasMatrix = false %}
  6. {% set hasSetup = false %}
  7. {% set hasExtras = false %}
  8. {% set productMinQty = product.calculateMinQty %}
  9. {% for option in product.options %}
  10.     {% if option.code == 'matrix' %}{% set hasMatrix = true %}{% endif %}
  11.     {% if option.code == 'setup-charge' %}{% set hasSetup = true %}{% endif %}
  12.     {% if option.code != 'matrix' and option.code != 'setup' and option.code != 'type' %}{% set hasExtras = true %}{% endif %}
  13. {% endfor %}
  14. <div class="options-wrap mt-6" id="sylius-product-selecting-variant" {{ sylius_test_html_attribute('product-selecting-variant') }}>
  15.     {{ sylius_template_event('sylius.shop.product.show.before_add_to_cart', {'product': product, 'order_item': order_item, 'show_price': show_price}) }}
  16.     {% form_theme form '@SyliusShop/Form/theme.html.twig' %}
  17.     {{ form_start(form, {'action': path('sylius_shop_ajax_cart_add_item', {'productId': product.id}), 'attr': {'id': 'sylius-product-adding-to-cart', 'data-js-add-to-cart': 'form', 'class': 'loadable', 'novalidate': 'novalidate', 'data-redirect': path(configuration.getRedirectRoute('summary'))}}) }}
  18.     {{ form_errors(form) }}
  19.     <div class="alert alert-danger d-none" data-js-add-to-cart="error" id="sylius-cart-validation-error" {{ sylius_test_html_attribute('cart-validation-error') }}></div>
  20.     <div class="row product-type-quantity">
  21.         <div class="col-md-6">
  22.             {% for option_form in form.cartItem.variant %}
  23.                 {% if loop.index == 1 %}
  24.                     {{ form_row(option_form, { 'attr': { 'data-option': option_form.vars.name } }) }}
  25.                 {% endif %}
  26.             {% endfor %}
  27.         </div>
  28.         <div class="col-md-6">
  29.             <label for="sylius_add_to_cart_cartItem_quantity" class="form-label">{{ 'app.ui.product.pieces'|trans }}</label>
  30.             <div class="add-to-cart-wrap {% if not product.simple %} col-xl-7 col-md-12 {% else %} col-12 {% endif %}">
  31.                 <div class="count-wrap{% if productMinQty %}-tierprice{% endif %} big">
  32.                     <input type="range" class="form-range d-md-none" min="0" max="10" id="quantity_range" value="0">
  33.                     {{ form_widget(form.cartItem.quantity, sylius_test_form_attribute('quantity')|sylius_merge_recursive({ 'value': productMinQty ?? 1 })) }}
  34.                 </div>
  35.             </div>
  36.         </div>
  37.         <div class="col-3 d-md-none">
  38.             <label for="quantity_range" class="form-label">{{ 'app.ui.product.unit_price'|trans }}</label>
  39.         </div>
  40.         <div class="col-9 text-primary d-md-none">
  41.             <b class="unit-price"></b>
  42.         </div>
  43.     </div>
  44.     {% if not product.simple and hasMatrix %}
  45.     <div class="row extras">
  46.         {% include '@SyliusShop/Product/Show/_options.html.twig' with  {'product': product, 'order_item': order_item, 'show_price': show_price} %}
  47.     </div>
  48.     {% endif %}
  49.     <div class="art-requirements mb-3">
  50.         <h3>{{ 'app.product.detail.art-requirements'|trans }}</h3>
  51.         <a href="/page/art-requirements" title="{{ 'app.product.detail.art-requirements'|trans }}" target="_blank">{{ 'app.product.detail.art-requirements-description'|trans }}</a>
  52.     </div>
  53.     <div class="row product-download">
  54.         <h3>{{ 'app.product.detail.download.title'|trans|raw }}</h3>
  55.         <div class="col-md-4">
  56.             {% if product.files is not empty %}
  57.                 {% for file in product.files %}
  58.                     {% if file.type == 'pdf' %}
  59.                     <a href="{{ asset('/media/file/' ~ file.path) }}" class="btn btn-secondary btn-download" download="{{ product.name }}.pdf">{{ 'app.product.detail.download.button'|trans }}</a>
  60.                     {% endif %}
  61.                 {% endfor %}
  62.                 <div class="description">{{ 'app.product.detail.download.description'|trans }}</div>
  63.             {% else %}
  64.                 <div class="description">{{ 'app.product.detail.download.no-download'|trans|raw }}</div>
  65.             {% endif %}
  66.         </div>
  67.         <div class="col-md-8">
  68.             <div class="form-group row">
  69.                 <div class="col-sm-24 col-md-24 col-lg-24">
  70.                     <div class="col-sm-20 col-md-20 col-lg-20">
  71.                         <div class="field artwork">
  72.                             {{ form_widget(form.cartItem.filesUploaded, sylius_test_form_attribute('filesUploaded')) }}
  73.                         </div>
  74.                         <p>{{ 'app.ui.product.allowed_types'|trans|raw }}</p>
  75.                     </div>
  76.                 </div>
  77.             </div>
  78.         </div>
  79.     </div>
  80.     <div class="row product-note-price">
  81.         <div class="col-md-8 product-note">
  82.             <h3>{{ 'app.product.detail.note_title'|trans|raw }}</h3>
  83.             {{ form_row(form.cartItem.note, { 'attr': { 'placeholder': 'app.form.order_item.note_placeholder'|trans } }) }}
  84.         </div>
  85.         <div class="col-md-4 mb-3 align-self-end">
  86.             {% if hasMatrix %}
  87.                 {# Metrix ak existuje #}
  88.                 {% for option_form in form.cartItem.variant %}
  89.                     {% if loop.index == 2 %}
  90.                         {% form_theme option_form '@SyliusShop/Form/theme.html.twig' %}
  91.                         {{ form_row(option_form, { 'attr': { 'data-option': option_form.vars.name } }) }}
  92.                     {% endif %}
  93.                 {% endfor %}
  94.             {% endif %}
  95.             {% if hasSetup %}
  96. {#                 Setup ak existuje#}
  97.                 {% for option_form in form.cartItem.variant %}
  98.                     {% if loop.index == 3 or (form.cartItem.variant|length == 2 and loop.index == 2) %}
  99.                         {% form_theme option_form '@SyliusShop/Form/theme.html.twig' %}
  100.                         {{ form_row(option_form, { 'attr': { 'data-option': option_form.vars.name } }) }}
  101.                     {% endif %}
  102.                 {% endfor %}
  103.             {% endif %}
  104.             <div class="row total-price">
  105.                 {# Vypocitana suma #}
  106.                 <div class="col-6 title">{{ 'app.product.detail.total_price'|trans }}</div>
  107.                 <div class="col-6 sum">{% include '@SyliusShop/Product/Show/_priceWidget.html.twig' %}</div>
  108.                 <div class="col-12 not-including-shipping">{{ 'app.product.detail.not_including_shipping'|trans }}</div>
  109.             </div>
  110.             <button type="submit" class="btn btn-add-to-cart JS_add-to-cart" aria-label="{{ 'app.product.detail.add_button'|trans }}" {{ sylius_test_html_attribute('add-to-cart-button') }}>{{ 'app.product.detail.add_button'|trans }}</button>
  111.         </div>
  112.     </div>
  113.     {{ form_row(form._token) }}
  114.     {{ form_end(form, {'render_rest': false}) }}
  115. </div>