custom/plugins/KkTheme/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_quantity_container %}
  3.     
  4.     
  5.     {% set purchasePrice = 0 %}
  6.     {% set cheapestPrice = 0 %}
  7.     
  8.     {% if product.calculatedPrice.unitPrice and product.calculatedPrice.unitPrice != 0 %}
  9.         {% set purchasePrice = product.calculatedPrice.unitPrice %}
  10.     {% endif %}
  11.     {% if product.calculatedPrices.elements[0].unitPrice and product.calculatedPrice.unitPrice != 0 %}
  12.         {% set purchasePrice = product.calculatedPrices.elements[0].unitPrice %}
  13.     {% endif %}
  14.     {% if product.calculatedCheapestPrice.unitPrice and product.calculatedCheapestPrice.unitPrice != 0 %}
  15.         {% set cheapestPrice = product.calculatedCheapestPrice.unitPrice %}
  16.     {% endif %}
  17.     {% if product.calculatedPrices|length > 1 %}
  18.         {% set breakloop = false %}
  19.         {% for price in product.calculatedPrices %}
  20.             {% if not breakloop %}
  21.                 {% set abStaffel = product.minPurchase %}
  22.                 {% if loop.index > 1 %}
  23.                     {% set idx = loop.index - 2 %}
  24.                     {% set pArr = product.calculatedPrices %}
  25.                     {% set abStaffel = pArr.elements[idx].quantity + 1 %}
  26.                     {% if abStaffel >= product.minPurchase %}
  27.                         {% set purchasePrice = price.unitPrice %}
  28.                         {% set breakloop = true %}
  29.                     {% endif %}
  30.                 {% endif %}
  31.             {% endif %}
  32.         {% endfor %}
  33.     {% endif %}
  34.     
  35.     {% set totalPrice = product.minPurchase * purchasePrice %}
  36.     <div class="calc-result-block col-6">
  37.         <span class="calc-cur-amount">{{ product.minPurchase }}</span> x 
  38.         <span class="calc-cur-price">{{ purchasePrice|number_format(2,",",".") }} &euro;</span> = 
  39.         <span class="calc-cur-total">{{ totalPrice|number_format(2,",",".") }} &euro;{{ "general.star"|trans|sw_sanitize }}</span>
  40.     </div>
  41.     <div class="col-6">
  42.         {#
  43.             Purchase: {{ purchasePrice }} | Unit: {{ price.unitPrice }} | Cheapest: {{ cheapestPrice }}
  44.         #}
  45.     </div>
  46.     
  47.     
  48.         <div class="col-6 calc-block">
  49.             {% block page_product_detail_buy_quantity %}
  50.                 
  51.                 <button type="button" class="btn btn-primary calc-btn calc-btn-down">-</button>
  52.                 <input name="lineItems[{{ product.id }}][quantity]" value="{{ product.minPurchase }}"
  53.                     class="product-detail-quantity-select calc-input-qty"                    
  54.                 />
  55.                 <button type="button" class="btn btn-primary calc-btn calc-btn-up">+</button>
  56.                 <input type="hidden" name="minPurchase" class="calc-min-purchase" value="{{ product.minPurchase }}" />
  57.                 <input type="hidden" name="purchaseStep" class="calc-purchase-step" value="{{ product.purchaseSteps }}" />
  58.                 <input type="hidden" name="maxPurchase" class="calc-max-purchase" value="{{ product.maxPurchase }}" />
  59.                 <input type="hidden" name="curPrice" class="calc-purchase-price" value="{% if purchasePrice %}{{ purchasePrice }}{% else %}{{ price.unitPrice }}{% endif %}" />
  60.                 <input type="hidden" name="totalPrice" class="calc-purchase-total" value="{{ totalPrice }}" />
  61.             {% endblock %}
  62.         </div>
  63.     {% endblock %}
  64.     
  65.     
  66. {% block page_product_detail_buy_button_container %}
  67.     <div class="col-6">
  68.         {% block page_product_detail_buy_button %}
  69.             {{ parent() }}
  70.         {% endblock %}
  71.     </div>
  72. {% endblock %}