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.     {% if shopware.config.core.listing.allowBuyInListing %}
  4.         <div class="product-action">
  5.             {% set isAvailable = not product.isCloseout or (product.availableStock >= product.minPurchase) %}
  6.             {% if isAvailable and not product.isGrouped and product.childCount <= 0 and product.calculatedPrices.count <= 1 %}
  7.                 {% block component_product_box_action_buy %}
  8.                     {# @var product \Shopware\Core\Content\Product\SalesChannel\SalesChannelProductEntity #}
  9.                        <form action="{{ path('frontend.checkout.line-item.add') }}"
  10.                               method="post"
  11.                               class="buy-widget"
  12.                               data-add-to-cart="true">
  13.                             {% block component_product_box_action_buy_csrf %}
  14.                                 {{ sw_csrf('frontend.checkout.line-item.add') }}
  15.                             {% endblock %}
  16.                             {% block component_product_box_action_form %}
  17.                                 {% block component_product_box_action_buy_redirect_input %}
  18.                                     {# fallback redirect back to detail page is deactivated via js #}
  19.                                     <input type="hidden"
  20.                                            name="redirectTo"
  21.                                            value="frontend.detail.page">
  22.                                     <input type="hidden"
  23.                                            name="redirectParameters"
  24.                                            data-redirect-parameters="true"
  25.                                            value='{"productId": "{{ product.id }}"}'>
  26.                                 {% endblock %}
  27.                                 {% block page_product_detail_buy_product_buy_info %}
  28.                                     <input type="hidden"
  29.                                            name="lineItems[{{ id }}][id]"
  30.                                            value="{{ id }}">
  31.                                     <input type="hidden"
  32.                                            name="lineItems[{{ id }}][referencedId]"
  33.                                            value="{{ id }}">
  34.                                     <input type="hidden"
  35.                                            name="lineItems[{{ id }}][type]"
  36.                                            value="product">
  37.                                     <input type="hidden"
  38.                                            name="lineItems[{{ id }}][stackable]"
  39.                                            value="1">
  40.                                     <input type="hidden"
  41.                                            name="lineItems[{{ id }}][removable]"
  42.                                            value="1">
  43.                                     <input type="hidden"
  44.                                            name="lineItems[{{ id }}][quantity]"
  45.                                            value="{{ product.minPurchase }}">
  46.                                 {% endblock %}
  47.                                 {% block page_product_detail_product_buy_meta %}
  48.                                     <input type="hidden"
  49.                                            name="product-name"
  50.                                            value="{{ product.translated.name }}">
  51.                                 {% endblock %}
  52.                                 {% block page_product_detail_product_buy_button %}
  53.                                     <button class="btn btn-block btn-buy"
  54.                                             title="{{ "listing.boxAddProduct"|trans|striptags }}">
  55.                                         {{ "listing.boxAddProduct"|trans|sw_sanitize }}
  56.                                     </button>
  57.                                 {% endblock %}
  58.                             {% endblock %}
  59.                         </form>
  60.                 {% endblock %}
  61.             {% else %}
  62.                 {% block component_product_box_action_detail %}
  63.                     <a href="{{ seoUrl('frontend.detail.page', {'productId': id}) }}"
  64.                        class="btn btn-block btn-light"
  65.                        title="{{ "listing.boxProductDetails"|trans|striptags }}">
  66.                         {{ "listing.boxProductDetails"|trans|sw_sanitize }}
  67.                     </a>
  68.                 {% endblock %}
  69.             {% endif %}
  70.         </div>
  71.     {% endif %}
  72.     {% block component_product_box_action_meta %}
  73.         <input type="hidden"
  74.                name="product-name"
  75.                value="{{ product.translated.name }}">
  76.         <input type="hidden"
  77.                name="product-id"
  78.                value="{{ id }}">
  79.     {% endblock %}
  80. {% endblock %}