custom/plugins/KayloBasicTheme/src/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.                             <button class="btn btn-block btn-buy"
  55.                                     title="{{ "listing.boxAddProduct"|trans|striptags }}">
  56.                                 {{ "listing.boxAddProduct"|trans|sw_sanitize }}
  57.                             </button>
  58.                         {% endblock %}
  59.                     {% endblock %}
  60.                 </form>
  61.             {% endblock %}
  62.         {% else %}
  63.             {% block component_product_box_action_detail %}
  64.                 <a href="{{ seoUrl('frontend.detail.page', {'productId': id}) }}"
  65.                    class="btn btn-block btn-light"
  66.                    title="{{ "listing.boxProductDetails"|trans|striptags }}">
  67.                     {{ "listing.boxProductDetails"|trans|sw_sanitize }}
  68.                 </a>
  69.             {% endblock %}
  70.         {% endif %}
  71.     </div>
  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 %}