custom/static-plugins/EfbStorefront/Resources/views/storefront/component/product/card/variant-action.html.twig line 1

Open in your IDE?
  1. {% block component_product_box_action_inner %}
  2.     {% set id = product.id %}
  3.     <div class="product-variant-action">
  4.         {% set isAvailable = not product.isCloseout or (product.availableStock >= product.minPurchase) %}
  5.         {% set displayFrom = product.calculatedPrices.count > 1 %}
  6.         {% set displayBuyButton = isAvailable and not displayFrom and product.childCount <= 0 %}
  7.         {% if context.customer and (not product.isCloseout or (product.availableStock >= product.minPurchase)) %}
  8.             {% block component_product_box_action_buy %}
  9.                 {# @var product \Shopware\Core\Content\Product\SalesChannel\SalesChannelProductEntity #}
  10.                 <form action="{{ path('frontend.checkout.line-item.add') }}"
  11.                       method="post"
  12.                       class="buy-widget buy-widget-variant"
  13.                       data-add-to-cart="true">
  14.                         <div class="qty">
  15.                             {% block component_product_box_action_buy_csrf %}
  16.                                 {{ sw_csrf('frontend.checkout.line-item.add') }}
  17.                             {% endblock %}
  18.                             {% block component_product_box_action_form %}
  19.                             {% block component_product_box_action_buy_redirect_input %}
  20.                                 {# fallback redirect back to detail page is deactivated via js #}
  21.                                 <input type="hidden"
  22.                                        name="redirectTo"
  23.                                        value="frontend.detail.page">
  24.                                 <input type="hidden"
  25.                                        name="redirectParameters"
  26.                                        data-redirect-parameters="true"
  27.                                        value='{"productId": "{{ product.id }}"}'>
  28.                             {% endblock %}
  29.                             {% block page_product_detail_buy_product_buy_info %}
  30.                                 <input type="hidden"
  31.                                        name="lineItems[{{ id }}][id]"
  32.                                        value="{{ id }}">
  33.                                 <input type="hidden"
  34.                                        name="lineItems[{{ id }}][referencedId]"
  35.                                        value="{{ id }}">
  36.                                 <input type="hidden"
  37.                                        name="lineItems[{{ id }}][type]"
  38.                                        value="product">
  39.                                 <input type="hidden"
  40.                                        name="lineItems[{{ id }}][stackable]"
  41.                                        value="1">
  42.                                 <input type="hidden"
  43.                                        name="lineItems[{{ id }}][removable]"
  44.                                        value="1">
  45.                                 <input type="number"
  46.                                        name="lineItems[{{ id }}][quantity]"
  47.                                        class="form-control product-detail-variant-quantity-input"
  48.                                        min="{{ product.minPurchase }}"
  49.                                        max="{{ product.calculatedMaxPurchase }}"
  50.                                        step="{{ product.purchaseSteps }}"
  51.                                        value="{{ product.minPurchase }}"
  52.                                 />
  53.                             {% endblock %}
  54.                             {% block page_product_detail_product_buy_meta %}
  55.                                 <input type="hidden"
  56.                                        name="product-name"
  57.                                        value="{{ product.translated.name }}">
  58.                             {% endblock %}
  59.                         </div>
  60.                         <div class="cta">
  61.                             {% block page_product_detail_product_buy_button %}
  62.                                 {# @deprecated tag:v6.5.0 - Bootstrap v5 removes `btn-block` class, use `d-grid` wrapper instead #}
  63.                                 <button class="btn btn-buy"
  64.                                         title="{{ "listing.boxAddProduct"|trans|striptags }}">
  65.                                     {% sw_icon 'shopping-bag' style {'namespace': 'EfbStorefront'} %}
  66.                                 </button>
  67.                             {% endblock %}
  68.                         </div>
  69.                         {% endblock %}
  70.                 </form>
  71.             {% endblock %}
  72.         {% else %}
  73.             {% block component_product_box_action_detail %}
  74.                 <a href="{{ seoUrl('frontend.detail.page', {'productId': id}) }}"
  75.                    class="btn btn-block btn-light"
  76.                    title="{{ "listing.boxProductDetails"|trans|striptags }}">
  77.                     {{ "listing.boxProductDetails"|trans|sw_sanitize }}
  78.                 </a>
  79.             {% endblock %}
  80.         {% endif %}
  81.     </div>
  82.     {% block component_product_box_action_meta %}
  83.         <input type="hidden"
  84.                name="product-name"
  85.                value="{{ product.translated.name }}">
  86.         <input type="hidden"
  87.                name="product-id"
  88.                value="{{ id }}">
  89.     {% endblock %}
  90. {% endblock %}