vendor/shopware/storefront/Resources/views/storefront/component/product/card/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-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 displayBuyButton and config('core.listing.allowBuyInListing') %}
  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"
  13.                       data-add-to-cart="true">
  14.                     {% block component_product_box_action_buy_csrf %}
  15.                         {{ sw_csrf('frontend.checkout.line-item.add') }}
  16.                     {% endblock %}
  17.                     {% block component_product_box_action_form %}
  18.                         {% block component_product_box_action_buy_redirect_input %}
  19.                             {# fallback redirect back to detail page is deactivated via js #}
  20.                             <input type="hidden"
  21.                                    name="redirectTo"
  22.                                    value="frontend.detail.page">
  23.                             <input type="hidden"
  24.                                    name="redirectParameters"
  25.                                    data-redirect-parameters="true"
  26.                                    value='{"productId": "{{ product.id }}"}'>
  27.                         {% endblock %}
  28.                         {% block page_product_detail_buy_product_buy_info %}
  29.                             <input type="hidden"
  30.                                    name="lineItems[{{ id }}][id]"
  31.                                    value="{{ id }}">
  32.                             <input type="hidden"
  33.                                    name="lineItems[{{ id }}][referencedId]"
  34.                                    value="{{ id }}">
  35.                             <input type="hidden"
  36.                                    name="lineItems[{{ id }}][type]"
  37.                                    value="product">
  38.                             <input type="hidden"
  39.                                    name="lineItems[{{ id }}][stackable]"
  40.                                    value="1">
  41.                             <input type="hidden"
  42.                                    name="lineItems[{{ id }}][removable]"
  43.                                    value="1">
  44.                             <input type="hidden"
  45.                                    name="lineItems[{{ id }}][quantity]"
  46.                                    value="{{ product.minPurchase }}">
  47.                         {% endblock %}
  48.                         {% block page_product_detail_product_buy_meta %}
  49.                             <input type="hidden"
  50.                                    name="product-name"
  51.                                    value="{{ product.translated.name }}">
  52.                         {% endblock %}
  53.                         {% block page_product_detail_product_buy_button %}
  54.                             {# @deprecated tag:v6.5.0 - Bootstrap v5 removes `btn-block` class, use `d-grid` wrapper instead #}
  55.                             {% if feature('v6.5.0.0') %}
  56.                                 <div class="d-grid">
  57.                                     <button class="btn btn-buy"
  58.                                             title="{{ "listing.boxAddProduct"|trans|striptags }}">
  59.                                         {{ "listing.boxAddProduct"|trans|sw_sanitize }}
  60.                                     </button>
  61.                                 </div>
  62.                             {% else %}
  63.                                 <button class="btn btn-block btn-buy"
  64.                                         title="{{ "listing.boxAddProduct"|trans|striptags }}">
  65.                                     {{ "listing.boxAddProduct"|trans|sw_sanitize }}
  66.                                 </button>
  67.                             {% endif %}
  68.                         {% endblock %}
  69.                     {% endblock %}
  70.                 </form>
  71.             {% endblock %}
  72.         {% else %}
  73.             {% block component_product_box_action_detail %}
  74.                 {# @deprecated tag:v6.5.0 - Bootstrap v5 removes `btn-block` class, use `d-grid` wrapper instead #}
  75.                 {% if feature('v6.5.0.0') %}
  76.                     <div class="d-grid">
  77.                         <a href="{{ seoUrl('frontend.detail.page', {'productId': id}) }}"
  78.                            class="btn btn-light"
  79.                            title="{{ "listing.boxProductDetails"|trans|striptags }}">
  80.                             {{ "listing.boxProductDetails"|trans|sw_sanitize }}
  81.                         </a>
  82.                     </div>
  83.                 {% else %}
  84.                     <a href="{{ seoUrl('frontend.detail.page', {'productId': id}) }}"
  85.                        class="btn btn-block btn-light"
  86.                        title="{{ "listing.boxProductDetails"|trans|striptags }}">
  87.                         {{ "listing.boxProductDetails"|trans|sw_sanitize }}
  88.                     </a>
  89.                 {% endif %}
  90.             {% endblock %}
  91.         {% endif %}
  92.     </div>
  93.     {% block component_product_box_action_meta %}
  94.         <input type="hidden"
  95.                name="product-name"
  96.                value="{{ product.translated.name }}">
  97.         <input type="hidden"
  98.                name="product-id"
  99.                value="{{ id }}">
  100.     {% endblock %}
  101. {% endblock %}