{% sw_extends '@Storefront/storefront/component/product/card/action.html.twig' %}
{# both buttons will lead to product detail page #}
{# if available and no variants: content from component_product_box_action_detail but other text #}
{# buy is a form in the standard for when article can be directly bought, replaced by link to detail page #}
{# include code from compare plugin copied because parent component cannot be extended due to button modification #}
{# if not available, or variants: configure btn. replaces detail button #}
{% block component_product_box_action_inner %}
{% set id = product.id %}
<div class="product-action">
{% set requestOnly = product.translated.customFields.grimm_customfields_productRequest_only %}
{% set isAvailable = not product.isCloseout or (product.availableStock >= product.minPurchase) %}
{% set displayFrom = product.calculatedPrices.count > 1 %}
{% set displayBuyButton = isAvailable and displayFrom == false and product.childCount <= 0 and (requestOnly == null) and product.variation is empty %}
{# button for no variant articles #}
{% if displayBuyButton %}
{% block component_product_box_action_buy %}
{# @var product \Shopware\Core\Content\Product\SalesChannel\SalesChannelProductEntity #}
<form action="{{ path('frontend.checkout.line-item.add') }}"
method="post"
class="buy-widget show-form-loader show-form-loader-buy-btn">
{% block component_product_box_action_buy_csrf %}
{{ parent() }}
{% endblock %}
{% block component_product_box_action_form %}
{% block component_product_box_action_buy_redirect_input %}
{{ parent() }}
{% 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-block btn-light"
title="{{ "listing.boxAddProduct"|trans|striptags }}">
{% sw_icon 'warenkorb' style {'pack': 'grimmtheme', 'namespace': 'GrimmTheme', 'size': 'md'} %}
</button>
{% endblock %}
{% endblock %}
</form>
{% endblock %}
{% else %}
{% block component_product_box_action_detail %}
<a href="{{ seoUrl('frontend.detail.page', {'productId': id}) }}"
class="btn btn-block btn-light"
title="{{ "listing.configureProduct"|trans|striptags }}">
{% sw_icon 'settings' style {'pack': 'grimmtheme', 'namespace': 'GrimmTheme', 'size': 'md'} %}
</a>
{% endblock %}
{% endif %}
</div>
{% block component_product_box_action_meta %}
{{ parent() }}
{% endblock %}
{% endblock %}