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. {# @deprecated tag:v6.5.0 - Block component_product_box_action_buy_csrf will be removed. #}
  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. {# @deprecated tag:v6.5.0 - Bootstrap v5 removes `btn-block` class, use `d-grid` wrapper instead #}
  56. {% if feature('v6.5.0.0') %}
  57. <div class="d-grid">
  58. <button class="btn btn-buy"
  59. title="{{ "listing.boxAddProduct"|trans|striptags }}">
  60. {{ "listing.boxAddProduct"|trans|sw_sanitize }}
  61. </button>
  62. </div>
  63. {% else %}
  64. <button class="btn btn-block btn-buy"
  65. title="{{ "listing.boxAddProduct"|trans|striptags }}">
  66. {{ "listing.boxAddProduct"|trans|sw_sanitize }}
  67. </button>
  68. {% endif %}
  69. {% endblock %}
  70. {% endblock %}
  71. </form>
  72. {% endblock %}
  73. {% else %}
  74. {% block component_product_box_action_detail %}
  75. {# @deprecated tag:v6.5.0 - Bootstrap v5 removes `btn-block` class, use `d-grid` wrapper instead #}
  76. {% if feature('v6.5.0.0') %}
  77. <div class="d-grid">
  78. <a href="{{ seoUrl('frontend.detail.page', {'productId': id}) }}"
  79. class="btn btn-light"
  80. title="{{ "listing.boxProductDetails"|trans|striptags }}">
  81. {{ "listing.boxProductDetails"|trans|sw_sanitize }}
  82. </a>
  83. </div>
  84. {% else %}
  85. <a href="{{ seoUrl('frontend.detail.page', {'productId': id}) }}"
  86. class="btn btn-block btn-light"
  87. title="{{ "listing.boxProductDetails"|trans|striptags }}">
  88. {{ "listing.boxProductDetails"|trans|sw_sanitize }}
  89. </a>
  90. {% endif %}
  91. {% endblock %}
  92. {% endif %}
  93. </div>
  94. {% block component_product_box_action_meta %}
  95. <input type="hidden"
  96. name="product-name"
  97. value="{{ product.translated.name }}">
  98. <input type="hidden"
  99. name="product-id"
  100. value="{{ id }}">
  101. {% endblock %}
  102. {% endblock %}