{% sw_extends '@parent/storefront/component/product/card/action.html.twig' %}
{% block component_product_box_action_inner %}
{% set id = product.id %}
<div class="product-action">
{% set isAvailable = not product.isCloseout or (product.availableStock >= product.minPurchase) %}
{% set displayFrom = product.calculatedPrices.count < 1 %}
{% set displayBuyButton = isAvailable and displayFrom and product.childCount <= 0 %}
{% set buyIcon = theme_config('productListingStylesProductBoxBuyIcon') %}
{% set detailIcon = theme_config('productListingStylesProductBoxDetailIcon') %}
{% set redirect = redirect ? redirect : '' %}
{% set showBuyButtonText = showBuyButtonText is not null ? showBuyButtonText : true %}
{% block component_product_box_action_wrapper %}
{% if displayBuyButton and config('core.listing.allowBuyInListing') %}
{% block component_product_box_action_buy %}
{# @var product \Shopware\Core\Content\Product\SalesChannel\SalesChannelProductEntity #}
{% if redirect == '' %}
<form action="{{ path('frontend.checkout.line-item.add') }}"
method="post"
class="buy-widget"
data-add-to-cart="true">
{% else %}
<form action="{{ path('frontend.checkout.line-item.add') }}"
method="post"
class="buy-widget"
data-form-csrf-handler="true">
{% endif %}
{% block component_product_box_action_buy_csrf %}
{{ parent() }}
{% endblock %}
{% block component_product_box_action_form %}
{% block component_product_box_action_buy_redirect_input %}
{% if redirect == '' %}
{{ parent() }}
{% else %}
<input type="hidden"
name="redirectTo"
value="{{ redirect }}">
{% endif %}
{% endblock %}
{% block page_product_detail_buy_product_buy_info %}
{{ parent() }}
{% endblock %}
{% block page_product_detail_product_buy_meta %}
{{ parent() }}
{% endblock %}
{% block page_product_detail_product_buy_button %}
<button class="btn btn-primary btn-buy"
title="{{ "listing.boxAddProduct"|trans|striptags }}">
{# Create reusable blocks #}
{% if (false) %}
{% block page_product_detail_product_buy_button_icon %}
{% sw_include "@parent/storefront/utilities/icon.html.twig" ignore missing with { 'name': buyIcon, 'size': 'xl'} %}
{% endblock %}
{% block page_product_detail_product_buy_button_text %}
{% if showBuyButtonText %}
<span class="boxAddProductText">
{{ "listing.boxAddProduct"|trans|sw_sanitize }}
</span>
{% endif %}
{% endblock %}
{% endif %}
{% if
(theme_config('productListingStylesProductBoxButton') == 'icon' and layout != 'image') or
(theme_config('productListingStylesProductBoxImageButton') == 'icon' and layout == 'image')
%}
{{ block('page_product_detail_product_buy_button_icon') }}
{% elseif
(theme_config('productListingStylesProductBoxButton') == 'text' and layout != 'image') or
(theme_config('productListingStylesProductBoxImageButton') == 'text' and layout == 'image')
%}
{{ block('page_product_detail_product_buy_button_text') }}
{% elseif
(theme_config('productListingStylesProductBoxButton') == 'icon-text' and layout != 'image') or
(theme_config('productListingStylesProductBoxImageButton') == 'icon-text' and layout == 'image')
%}
{{ block('page_product_detail_product_buy_button_icon') }}
{{ block('page_product_detail_product_buy_button_text') }}
{% elseif
(theme_config('productListingStylesProductBoxButton') == 'reverse-icon-text' and layout != 'image') or
(theme_config('productListingStylesProductBoxImageButton') == 'reverse-icon-text' and layout == 'image')
%}
{{ block('page_product_detail_product_buy_button_text') }}
{{ block('page_product_detail_product_buy_button_icon') }}
{% endif %}
</button>
{% endblock %}
{% endblock %}
</form>
{% endblock %}
{% else %}
{% block component_product_box_action_detail %}
<a href="{{ seoUrl('frontend.detail.page', {'productId': id}) }}"
class="btn btn-primary btn-buy"
title="{{ "listing.boxProductDetails"|trans|striptags }}">
{# Create reusable blocks #}
{% if (false) %}
{% block component_product_box_action_detail_icon %}
{% sw_include "@parent/storefront/utilities/icon.html.twig" ignore missing with { 'name': detailIcon, 'size': 'xl'} %}
{% endblock %}
{% block component_product_box_action_detail_text %}
{% if showBuyButtonText %}
<span class="boxProductDetailsText">
{{ "listing.boxProductDetails"|trans|sw_sanitize }}
</span>
{% endif %}
{% endblock %}
{% endif %}
{% if
(theme_config('productListingStylesProductBoxButton') == 'icon' and layout != 'image') or
(theme_config('productListingStylesProductBoxImageButton') == 'icon' and layout == 'image')
%}
{{ block('component_product_box_action_detail_icon') }}
{% elseif
(theme_config('productListingStylesProductBoxButton') == 'text' and layout != 'image') or
(theme_config('productListingStylesProductBoxImageButton') == 'text' and layout == 'image')
%}
{{ block('component_product_box_action_detail_text') }}
{% elseif
(theme_config('productListingStylesProductBoxButton') == 'icon-text' and layout != 'image') or
(theme_config('productListingStylesProductBoxImageButton') == 'icon-text' and layout == 'image')
%}
{{ block('component_product_box_action_detail_icon') }}
{{ block('component_product_box_action_detail_text') }}
{% elseif
(theme_config('productListingStylesProductBoxButton') == 'reverse-icon-text' and layout != 'image') or
(theme_config('productListingStylesProductBoxImageButton') == 'reverse-icon-text' and layout == 'image')
%}
{{ block('component_product_box_action_detail_text') }}
{{ block('component_product_box_action_detail_icon') }}
{% endif %}
</a>
{% endblock %}
{% endif %}
{% endblock %}
</div>
{% block component_product_box_action_meta %}
{{ parent() }}
{% endblock %}
{% endblock %}