custom/plugins/MDR_Theme/src/Resources/views/storefront/component/product/card/action.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/component/product/card/action.html.twig' %}
  2. {% block component_product_box_action_inner %}
  3.     {% set id = product.id %}
  4.     {% if shopware.config.core.listing.allowBuyInListing %}
  5.         <div class="product-action">
  6.             {% set isAvailable = not product.isCloseout or (product.availableStock >= product.minPurchase) %}
  7.             {% set isVariant = product.parentId is not null %}
  8.             {% if isAvailable and not product.isGrouped and not isVariant and product.childCount <= 0 %}
  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.                                 <input type="hidden"
  21.                                        name="redirectTo"
  22.                                        value="frontend.cart.offcanvas"/>
  23.                             {% endblock %}
  24.                             {% block page_product_detail_buy_product_buy_info %}
  25.                                 <input type="hidden"
  26.                                        name="lineItems[{{ id }}][id]"
  27.                                        value="{{ id }}">
  28.                                 <input type="hidden"
  29.                                        name="lineItems[{{ id }}][referencedId]"
  30.                                        value="{{ id }}">
  31.                                 <input type="hidden"
  32.                                        name="lineItems[{{ id }}][type]"
  33.                                        value="product">
  34.                                 <input type="hidden"
  35.                                        name="lineItems[{{ id }}][stackable]"
  36.                                        value="1">
  37.                                 <input type="hidden"
  38.                                        name="lineItems[{{ id }}][removable]"
  39.                                        value="1">
  40.                                 <input type="hidden"
  41.                                        name="lineItems[{{ id }}][quantity]"
  42.                                        value="1">
  43.                             {% endblock %}
  44.                             <button class="btn btn-block btn-sm btn-buy"
  45.                                     title="{{ "listing.boxAddProduct"|trans|striptags }}">
  46.                                 {{ "listing.boxAddProduct"|trans|sw_sanitize }}
  47.                             </button>
  48.                         {% endblock %}
  49.                     </form>
  50.                 {% endblock %}
  51.             {% else %}
  52.                 {% block component_product_box_action_detail %}
  53.                     <a href="{{ seoUrl('frontend.detail.page', {'productId': id}) }}"
  54.                        class="btn btn-block btn-light btn-sm btn-detail"
  55.                        title="{{ "listing.boxProductDetails"|trans|striptags }}">
  56.                         {{ "listing.boxProductDetails"|trans|sw_sanitize }}
  57.                     </a>
  58.                 {% endblock %}
  59.             {% endif %}
  60.         </div>
  61.     {% endif %}
  62.     {% block component_product_box_action_meta %}
  63.         <input type="hidden"
  64.                name="product-name"
  65.                value="{{ product.translated.name }}">
  66.         <input type="hidden"
  67.                name="product-id"
  68.                value="{{ id }}">
  69.     {% endblock %}
  70. {% endblock %}