custom/plugins/WebLabels/src/Resources/views/storefront/component/product/card/action.html.twig line 1

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