custom/plugins/HyBuys/src/Resources/views/storefront/page/product-detail/buy-widget-form.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/page/product-detail/buy-widget-form.html.twig' %}
  2. {% block page_product_detail_buy_form_inner %}
  3.     {# @var page \Shopware\Storefront\Page\Product\ProductPage #}
  4.     {# @var product \Shopware\Core\Content\Product\SalesChannel\SalesChannelProductEntity #}
  5.     {% set product = page.product %}
  6.     {% set addToWishlistOptions = {
  7.         productId: product.id,
  8.         router: {
  9.             add: {
  10.                 afterLoginPath: path('frontend.wishlist.add.after.login', { productId: product.id }),
  11.                 path: path('frontend.wishlist.product.add', { productId: product.id }),
  12.                 token: sw_csrf('frontend.wishlist.product.add', {"mode": "token"})
  13.             },
  14.             remove: {
  15.                 path: path('frontend.wishlist.product.remove', { productId: product.id }),
  16.                 token: sw_csrf('frontend.wishlist.product.remove', {"mode": "token"}),
  17.             }
  18.         }
  19.     } %}
  20.     <form
  21.         id="productDetailPageBuyProductForm"
  22.         action="{% block page_product_detail_buy_form_action %}{{ path('frontend.checkout.line-item.add') }}{% endblock %}"
  23.         method="post"
  24.         class="buy-widget"
  25.         data-add-to-cart="true">
  26.         {% block page_product_detail_buy_form_inner_csrf %}
  27.             {{ sw_csrf('frontend.checkout.line-item.add') }}
  28.         {% endblock %}
  29.         {% set buyable = product.available and product.childCount <= 0 and product.calculatedMaxPurchase > 0 %}
  30.         {% block page_product_detail_buy_container %}
  31.             {% if buyable %}
  32.                 {% set selectQuantityThreshold = 100 %}
  33.                 <div class="primary_actions {{ formRowClass }} buy-widget-container">
  34. {#                <div class="{{ formRowClass }} buy-widget-container">#}
  35.                     {% block page_product_detail_buy_quantity_container %}
  36.                         <div class="product_qty">
  37.                             <div class="block_subtitle">Quantity</div>
  38.                             {% set selectQuantityThreshold = 100 %}
  39.                             {% block page_product_detail_buy_quantity %}
  40.                                     {% block page_product_detail_buy_quantity_input_group %}
  41.                                         <div class="qty_block">
  42.                                             {% block page_product_detail_buy_quantity_input %}
  43.                                                 <span class="decrease_btn"></span>
  44.                                                 <label>
  45.                                                     <span class="label">quantity</span>
  46.                                                     <input
  47.                                                         type="number"
  48.                                                         name="lineItems[{{ product.id }}][quantity]"
  49.                                                         class="qty_input"
  50.                                                         min="{{ product.minPurchase }}"
  51.                                                         max="{{ product.calculatedMaxPurchase }}"
  52.                                                         step="{{ product.purchaseSteps }}"
  53.                                                         value="{{ product.minPurchase }}"
  54.                                                         oninput="this.value=this.value.replace(/[^0-9]/g,'');"
  55.                                                         maxlength="3"
  56.                                                     />
  57.                                                 </label>
  58.                                                 <span class="increase_btn"></span>
  59.                                             {% endblock %}
  60.                                             {% block page_product_detail_buy_quantity_input_unit %}
  61.                                                 {% if product.translated.packUnit %}
  62.                                                     {% if not feature('v6.5.0.0') %}
  63.                                                         <div class="input-group-append">
  64.                                                     {% endif %}
  65.                                                     <span class="input-group-text">
  66.                                                             {% if product.minPurchase > 1 and product.translated.packUnitPlural %}
  67.                                                                 {{ product.translated.packUnitPlural }}
  68.                                                             {% elseif product.translated.packUnit %}
  69.                                                                 {{ product.translated.packUnit }}
  70.                                                             {% endif %}
  71.                                                         </span>
  72.                                                     {% if not feature('v6.5.0.0') %}
  73.                                                         </div>
  74.                                                     {% endif %}
  75.                                                 {% endif %}
  76.                                         </div>
  77.                                     {% endblock %}
  78.                                     {% endblock %}
  79.                             {% endblock %}
  80.                         </div>
  81.                     {% endblock %}
  82.                     {% block page_product_detail_buy_redirect_input %}
  83.                         {# fallback redirect back to detail page is deactivated via js #}
  84.                         <input type="hidden"
  85.                                name="redirectTo"
  86.                                value="frontend.detail.page">
  87.                         <input type="hidden"
  88.                                name="redirectParameters"
  89.                                data-redirect-parameters="true"
  90.                                value='{"productId": "{{ product.id }}"}'>
  91.                     {% endblock %}
  92.                     {% block page_product_detail_buy_product_buy_info %}
  93.                         <input type="hidden"
  94.                                name="lineItems[{{ product.id }}][id]"
  95.                                value="{{ product.id }}">
  96.                         <input type="hidden"
  97.                                name="lineItems[{{ product.id }}][type]"
  98.                                value="product">
  99.                         <input type="hidden"
  100.                                name="lineItems[{{ product.id }}][referencedId]"
  101.                                value="{{ product.id }}">
  102.                         <input type="hidden"
  103.                                name="lineItems[{{ product.id }}][stackable]"
  104.                                value="1">
  105.                         <input type="hidden"
  106.                                name="lineItems[{{ product.id }}][removable]"
  107.                                value="1">
  108.                     {% endblock %}
  109.                     {% block page_product_detail_product_buy_meta %}
  110.                         <input type="hidden"
  111.                                name="product-name"
  112.                                value="{{ product.translated.name }}">
  113.                         <input type="hidden"
  114.                                name="brand-name"
  115.                                value="{{ product.manufacturer.getName() }}">
  116.                     {% endblock %}
  117.                     {% block page_product_detail_buy_button_container %}
  118.                         <div class="add_cart_btn">
  119.                             {% block page_product_detail_buy_button %}
  120.                                 {# @deprecated tag:v6.5.0 - Bootstrap v5 removes `btn-block` class, use `d-grid` wrapper instead #}
  121.                                 {% if feature('v6.5.0.0') %}
  122.                                         <button class="primary_btn"
  123.                                                 title="{{ "detail.addProduct"|trans|striptags }}"
  124.                                                 aria-label="{{ "detail.addProduct"|trans|striptags }}">
  125. {#                                            {{ "detail.addProduct"|trans|sw_sanitize }}#}
  126.                                             ADD TO CART
  127.                                         </button>
  128.                                 {% else %}
  129.                                     <button class="primary_btn"
  130.                                             title="{{ "detail.addProduct"|trans|striptags }}"
  131.                                             aria-label="{{ "detail.addProduct"|trans|striptags }}">
  132. {#                                        {{ "detail.addProduct"|trans|sw_sanitize }}#}
  133.                                         ADD TO CART
  134.                                     </button>
  135.                                 {% endif %}
  136.                             {% endblock %}
  137.                         </div>
  138.                     {% endblock %}
  139. {#                </div>#}
  140.             {% endif %}
  141.         {% endblock %}
  142.                 </div>
  143.     </form>
  144.     {% if config('core.cart.wishlistEnabled') %}
  145.     {% block component_product_wishlist_button %}
  146.         <div class="secondary_actions">
  147.             <a href="#"
  148.                class="add_favorite icon_heart product-wishlist-{{ productId }} product-wishlist-action product-wishlist-not-added product-wishlist-loading"
  149.                title="{{ "listing.toggleWishlist"|trans|sw_sanitize }}"
  150.                data-add-to-wishlist="true"
  151.                data-add-to-wishlist-options="{{ addToWishlistOptions|json_encode }}">add favorite</a>
  152.         </div>
  153.     {% endblock %}
  154.     {% endif %}
  155. {% endblock %}