{%- macro format(amount, currency_code = " SAR") -%} {% set localeCode = "tr" %} {{ money_format(amount) }} {{ currency_code }} {%- endmacro -%} {%- macro convertAndFormat(amount) -%} {% from _self import format %} {{- format(amount) }} {%- endmacro -%} {%- macro calculatePrice(variant,opt) -%} {% from _self import convertAndFormat %} {% if variant %} {% set productPrice = variant.productPrice %} {# {% set loginCustomer = app.session.get('loginCustomer') %}#} {# {% if loginCustomer and loginCustomer.paymentType == '1' %}#} {# {% set originalPrice = productPrice.cashPriceOriginal %}#} {# {% set discount = productPrice.cashPriceDiscount %}#} {# {% set price = productPrice.cashPrice %}#} {# {% elseif loginCustomer.paymentType == '2' %}#} {# {% set originalPrice = productPrice.installmentPriceOriginal %}#} {# {% set discount = productPrice.installmentPriceDiscount %}#} {# {% set price = productPrice.installmentPrice %}#} {# {% elseif loginCustomer.paymentType == '3' %}#} {# {% set originalPrice = productPrice.retailPriceOriginal %}#} {# {% set discount = productPrice.retailPriceDiscount %}#} {# {% set price = productPrice.retailPrice %}#} {# {% endif %}#} {% set priceDetail = productPrice|product_price_customer %} {% set originalPrice = priceDetail.originalPrice %} {% set discount = priceDetail.discount %} {% set price = priceDetail.price %} {% if price|default %} {% if opt.originalPrice|default and discount > 0 %} {{- convertAndFormat(originalPrice) }} {% endif %} {{- convertAndFormat(price) }} {% endif %} {% endif %} {%- endmacro -%} {#{%- macro calculateInsallmentPrice(variant) -%}#} {# {% from _self import convertAndFormat %}#} {# {{- convertAndFormat(variant|sylius_calculate_original_price({'channel': sylius.channel})) }}#} {#{%- endmacro -%}#}