vendor/shopware/platform/src/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.     {% if config('core.listing.allowBuyInListing') %}
  4.         <div class="product-action">
  5.             {% set isAvailable = not product.isCloseout or (product.availableStock >= product.minPurchase) %}
  6.             {% set displayFrom = product.calculatedPrices.count > 1 %}
  7.             {% set displayBuyButton = isAvailable and not displayFrom and product.childCount <= 0 %}
  8.             {% if displayBuyButton %}
  9.                 {% block component_product_box_action_buy %}
  10.                     {# @var product \Shopware\Core\Content\Product\SalesChannel\SalesChannelProductEntity #}
  11.                        <form action="{{ path('frontend.checkout.line-item.add') }}"
  12.                               method="post"
  13.                               class="buy-widget"
  14.                               data-add-to-cart="true">
  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="hidden"
  46.                                            name="lineItems[{{ id }}][quantity]"
  47.                                            value="{{ product.minPurchase }}">
  48.                                 {% endblock %}
  49.                                 {% block page_product_detail_product_buy_meta %}
  50.                                     <input type="hidden"
  51.                                            name="product-name"
  52.                                            value="{{ product.translated.name }}">
  53.                                 {% endblock %}
  54.                                 {% block page_product_detail_product_buy_button %}
  55.                                     <button class="btn btn-block btn-buy"
  56.                                             title="{{ "listing.boxAddProduct"|trans|striptags }}">
  57.                                         {{ "listing.boxAddProduct"|trans|sw_sanitize }}
  58.                                     </button>
  59.                                 {% endblock %}
  60.                             {% endblock %}
  61.                         </form>
  62.                 {% endblock %}
  63.             {% else %}
  64.                 {% block component_product_box_action_detail %}
  65.                     <a href="{{ seoUrl('frontend.detail.page', {'productId': id}) }}"
  66.                        class="btn btn-block btn-light"
  67.                        title="{{ "listing.boxProductDetails"|trans|striptags }}">
  68.                         {{ "listing.boxProductDetails"|trans|sw_sanitize }}
  69.                     </a>
  70.                 {% endblock %}
  71.             {% endif %}
  72.         </div>
  73.     {% endif %}
  74.     {% block component_product_box_action_meta %}
  75.         <input type="hidden"
  76.                name="product-name"
  77.                value="{{ product.translated.name }}">
  78.         <input type="hidden"
  79.                name="product-id"
  80.                value="{{ id }}">
  81.     {% endblock %}
  82. {% endblock %}