vendor/shopware/storefront/Resources/views/storefront/component/buy-widget/buy-widget-form.html.twig line 1

Open in your IDE?
  1. {% block buy_widget_buy_form_inner %}
  2.     <form
  3.         id="productDetailPageBuyProductForm"
  4.         action="{% block buy_widget_buy_form_action %}{{ path('frontend.checkout.line-item.add') }}{% endblock %}"
  5.         method="post"
  6.         class="buy-widget"
  7.         data-add-to-cart="true">
  8.         {% block buy_widget_buy_form_inner_csrf %}
  9.             {{ sw_csrf('frontend.checkout.line-item.add') }}
  10.         {% endblock %}
  11.         {% set buyable = product.available and product.childCount <= 0 and product.calculatedMaxPurchase > 0 %}
  12.         {% block buy_widget_buy_container %}
  13.             {% if buyable %}
  14.                 <div class="{{ formRowClass }} buy-widget-container">
  15.                     {% block buy_widget_buy_quantity_container %}
  16.                         <div class="col-4">
  17.                             {% block buy_widget_buy_quantity %}
  18.                                 <select name="lineItems[{{ product.id }}][quantity]"
  19.                                         class="{{ formSelectClass }} product-detail-quantity-select">
  20.                                     {% for quantity in range(product.minPurchase, product.calculatedMaxPurchase, product.purchaseSteps) %}
  21.                                         <option value="{{ quantity }}">
  22.                                             {{ quantity }}
  23.                                             {% if quantity == 1 %}
  24.                                                 {% if product.translated.packUnit %} {{ product.translated.packUnit }}{% endif %}
  25.                                             {% else %}
  26.                                                 {% if product.translated.packUnitPlural %}
  27.                                                     {{ product.translated.packUnitPlural }}
  28.                                                 {% elseif product.translated.packUnit %}
  29.                                                     {{ product.translated.packUnit }}
  30.                                                 {% endif %}
  31.                                             {% endif %}
  32.                                         </option>
  33.                                     {% endfor %}
  34.                                 </select>
  35.                             {% endblock %}
  36.                         </div>
  37.                     {% endblock %}
  38.                     {% block buy_widget_buy_redirect_input %}
  39.                         {# fallback redirect back to detail page is deactivated via js #}
  40.                         <input type="hidden"
  41.                                name="redirectTo"
  42.                                value="frontend.detail.page">
  43.                         <input type="hidden"
  44.                                name="redirectParameters"
  45.                                data-redirect-parameters="true"
  46.                                value='{"productId": "{{ product.id }}"}'>
  47.                     {% endblock %}
  48.                     {% block buy_widget_buy_product_buy_info %}
  49.                         <input type="hidden"
  50.                                name="lineItems[{{ product.id }}][id]"
  51.                                value="{{ product.id }}">
  52.                         <input type="hidden"
  53.                                name="lineItems[{{ product.id }}][type]"
  54.                                value="product">
  55.                         <input type="hidden"
  56.                                name="lineItems[{{ product.id }}][referencedId]"
  57.                                value="{{ product.id }}">
  58.                         <input type="hidden"
  59.                                name="lineItems[{{ product.id }}][stackable]"
  60.                                value="1">
  61.                         <input type="hidden"
  62.                                name="lineItems[{{ product.id }}][removable]"
  63.                                value="1">
  64.                     {% endblock %}
  65.                     {% block buy_widget_product_buy_meta %}
  66.                         <input type="hidden"
  67.                                name="product-name"
  68.                                value="{{ product.translated.name }}">
  69.                         <input type="hidden"
  70.                                name="brand-name"
  71.                                value="{{ product.manufacturer.getName() }}">
  72.                     {% endblock %}
  73.                     {% block buy_widget_buy_button_container %}
  74.                         <div class="col-8">
  75.                             {% block buy_widget_buy_button %}
  76.                                 <button class="btn btn-primary btn-block btn-buy"
  77.                                         title="{{ "detail.addProduct"|trans|striptags }}"
  78.                                         aria-label="{{ "detail.addProduct"|trans|striptags }}">
  79.                                     {{ "detail.addProduct"|trans|sw_sanitize }}
  80.                                 </button>
  81.                             {% endblock %}
  82.                         </div>
  83.                     {% endblock %}
  84.                 </div>
  85.             {% endif %}
  86.         {% endblock %}
  87.     </form>
  88. {% endblock %}