vendor/shopware/storefront/Resources/views/storefront/page/product-detail/buy-widget-form.html.twig line 1

Open in your IDE?
  1. {% block page_product_detail_buy_form_inner %}
  2.     {# @var page \Shopware\Storefront\Page\Product\ProductPage #}
  3.     {# @var product \Shopware\Core\Content\Product\SalesChannel\SalesChannelProductEntity #}
  4.     {% set product = page.product %}
  5.     <form
  6.         id="productDetailPageBuyProductForm"
  7.         action="{% block page_product_detail_buy_form_action %}{{ path('frontend.checkout.line-item.add') }}{% endblock %}"
  8.         method="post"
  9.         class="buy-widget"
  10.         data-add-to-cart="true">
  11.         {% block page_product_detail_buy_form_inner_csrf %}
  12.             {{ sw_csrf('frontend.checkout.line-item.add') }}
  13.         {% endblock %}
  14.         {% set buyable = product.available and product.childCount <= 0 and product.calculatedMaxPurchase > 0 %}
  15.         {% block page_product_detail_buy_container %}
  16.             {% if buyable %}
  17.                 <div class="{{ formRowClass }} buy-widget-container">
  18.                     {% block page_product_detail_buy_quantity_container %}
  19.                         <div class="col-4">
  20.                             {% block page_product_detail_buy_quantity %}
  21.                                 <select name="lineItems[{{ product.id }}][quantity]"
  22.                                         class="{{ formSelectClass }} product-detail-quantity-select">
  23.                                     {% for quantity in range(product.minPurchase, product.calculatedMaxPurchase, product.purchaseSteps) %}
  24.                                         <option value="{{ quantity }}">
  25.                                             {{ quantity }}
  26.                                             {% if quantity == 1 %}
  27.                                                 {% if product.translated.packUnit %} {{ product.translated.packUnit }}{% endif %}
  28.                                             {% else %}
  29.                                                 {% if product.translated.packUnitPlural %}
  30.                                                     {{ product.translated.packUnitPlural }}
  31.                                                 {% elseif product.translated.packUnit %}
  32.                                                     {{ product.translated.packUnit }}
  33.                                                 {% endif %}
  34.                                             {% endif %}
  35.                                         </option>
  36.                                     {% endfor %}
  37.                                 </select>
  38.                             {% endblock %}
  39.                         </div>
  40.                     {% endblock %}
  41.                     {% block page_product_detail_buy_redirect_input %}
  42.                         {# fallback redirect back to detail page is deactivated via js #}
  43.                         <input type="hidden"
  44.                                name="redirectTo"
  45.                                value="frontend.detail.page">
  46.                         <input type="hidden"
  47.                                name="redirectParameters"
  48.                                data-redirect-parameters="true"
  49.                                value='{"productId": "{{ product.id }}"}'>
  50.                     {% endblock %}
  51.                     {% block page_product_detail_buy_product_buy_info %}
  52.                         <input type="hidden"
  53.                                name="lineItems[{{ product.id }}][id]"
  54.                                value="{{ product.id }}">
  55.                         <input type="hidden"
  56.                                name="lineItems[{{ product.id }}][type]"
  57.                                value="product">
  58.                         <input type="hidden"
  59.                                name="lineItems[{{ product.id }}][referencedId]"
  60.                                value="{{ product.id }}">
  61.                         <input type="hidden"
  62.                                name="lineItems[{{ product.id }}][stackable]"
  63.                                value="1">
  64.                         <input type="hidden"
  65.                                name="lineItems[{{ product.id }}][removable]"
  66.                                value="1">
  67.                     {% endblock %}
  68.                     {% block page_product_detail_product_buy_meta %}
  69.                         <input type="hidden"
  70.                                name="product-name"
  71.                                value="{{ product.translated.name }}">
  72.                         <input type="hidden"
  73.                                name="brand-name"
  74.                                value="{{ product.manufacturer.getName() }}">
  75.                     {% endblock %}
  76.                     {% block page_product_detail_buy_button_container %}
  77.                         <div class="col-8">
  78.                             {% block page_product_detail_buy_button %}
  79.                                 {# @deprecated tag:v6.5.0 - Bootstrap v5 removes `btn-block` class, use `d-grid` wrapper instead #}
  80.                                 {% if feature('v6.5.0.0') %}
  81.                                     <div class="d-grid">
  82.                                         <button class="btn btn-primary btn-buy"
  83.                                                 title="{{ "detail.addProduct"|trans|striptags }}"
  84.                                                 aria-label="{{ "detail.addProduct"|trans|striptags }}">
  85.                                             {{ "detail.addProduct"|trans|sw_sanitize }}
  86.                                         </button>
  87.                                     </div>
  88.                                 {% else %}
  89.                                     <button class="btn btn-primary btn-block btn-buy"
  90.                                             title="{{ "detail.addProduct"|trans|striptags }}"
  91.                                             aria-label="{{ "detail.addProduct"|trans|striptags }}">
  92.                                         {{ "detail.addProduct"|trans|sw_sanitize }}
  93.                                     </button>
  94.                                 {% endif %}
  95.                             {% endblock %}
  96.                         </div>
  97.                     {% endblock %}
  98.                 </div>
  99.             {% endif %}
  100.         {% endblock %}
  101.     </form>
  102. {% endblock %}