custom/plugins/GrimmTheme/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. {# both buttons will lead to product detail page #}
  3. {# if available and no variants: content from component_product_box_action_detail but other text #}
  4. {# buy is a form in the standard for when article can be directly bought, replaced by link to detail page #}
  5. {# include code from compare plugin copied because parent component cannot be extended due to button modification #}
  6. {# if not available, or variants: configure btn. replaces detail button #}
  7. {% block component_product_box_action_inner %}
  8.     {% set id = product.id %}
  9.     <div class="product-action">
  10.         {% set requestOnly = product.translated.customFields.grimm_customfields_productRequest_only %}
  11.         {% set isAvailable = not product.isCloseout or (product.availableStock >= product.minPurchase) %}
  12.         {% set displayFrom = product.calculatedPrices.count > 1 %}
  13.         {% set displayBuyButton = isAvailable and displayFrom == false and product.childCount <= 0 and (requestOnly == null) and product.variation is empty %}
  14.         {# button for no variant articles #}
  15.         {% if displayBuyButton %}
  16.             {% block component_product_box_action_buy %}
  17.                 {# @var product \Shopware\Core\Content\Product\SalesChannel\SalesChannelProductEntity #}
  18.                 <form action="{{ path('frontend.checkout.line-item.add') }}"
  19.                       method="post"
  20.                       class="buy-widget show-form-loader show-form-loader-buy-btn">
  21.                     {% block component_product_box_action_buy_csrf %}
  22.                         {{ parent() }}
  23.                     {% endblock %}
  24.                     {% block component_product_box_action_form %}
  25.                         {% block component_product_box_action_buy_redirect_input %}
  26.                             {{ parent() }}
  27.                         {% endblock %}
  28.                         {% block page_product_detail_buy_product_buy_info %}
  29.                             {{ parent() }}
  30.                         {% endblock %}
  31.                         {% block page_product_detail_product_buy_meta %}
  32.                             {{ parent() }}
  33.                         {% endblock %}
  34.                         {% block page_product_detail_product_buy_button %}
  35.                             <button class="btn btn-block btn-light"
  36.                                     title="{{ "listing.boxAddProduct"|trans|striptags }}">
  37.                                 {% sw_icon 'warenkorb' style {'pack': 'grimmtheme', 'namespace': 'GrimmTheme', 'size': 'md'} %}
  38.                             </button>
  39.                         {% endblock %}
  40.                     {% endblock %}
  41.                 </form>
  42.             {% endblock %}
  43.         {% else %}
  44.             {% block component_product_box_action_detail %}  
  45.                 <a href="{{ seoUrl('frontend.detail.page', {'productId': id}) }}"
  46.                     class="btn btn-block btn-light"
  47.                     title="{{ "listing.configureProduct"|trans|striptags }}">
  48.                     {% sw_icon 'settings' style {'pack': 'grimmtheme', 'namespace': 'GrimmTheme', 'size': 'md'} %}
  49.                 </a>
  50.             {% endblock %}
  51.         {% endif %}
  52.     </div>
  53.     {% block component_product_box_action_meta %}
  54.         {{ parent() }}
  55.     {% endblock %}
  56. {% endblock %}