{%- macro replacedUser(text) -%} {% set user = getCustomerUser() %} {% set profile = user.profile %} {% set date = "now"|date('d.m.Y H:i') %} {% set cartSession = app.session.get("cart") %} {% set addressId = cartSession['shippingAddress'] %} {% if addressId %} {% set address = getCustomerAddress({'id':addressId}) %} {% endif %} {% set replaced = { '[adsoyad]': profile.fullName|default, '[email]': user.email|default, '[tarih]': date|default, '[telefon]': profile.phoneNumber|default, '[adres]': address.address|default } %} {% set text = text|replace(replaced) %} {{ text|raw }} {% endmacro %} {%- macro replacedOrder(text) -%} {% set user = getCustomerUser() %} {% set profile = user.profile %} {% set date = "now"|date('d.m.Y H:i') %} {% set summaryCart = getSummartCart() %} {% set cartSession = app.session.get("cart") %} {% set shippingAddressId = cartSession['shippingAddress'] %} {% if shippingAddressId %} {% set shippingAddress = getCustomerAddress({'id':shippingAddressId}) %} {% endif %} {% set billingAddressId = cartSession['billingAddress'] %} {% if billingAddressId %} {% set billingAddress = getCustomerAddress({'id':billingAddressId}) %} {% endif %} {% set urunler = _self.getUrunler() %} {% set replaced = { '[siparis_fiyat]' : money_format(summaryCart['total']|default("0"))~" SAR", '[kargo_fiyat]' : money_format(summaryCart['cargo']|default("0"))~" SAR", '[odeme_sekli]' : "", '[teslimat_adres]' : shippingAddress.address|default, '[teslimat_adsoyad]' : shippingAddress.fullName|default, '[fatura_adres]' : billingAddress.address|default, '[urunler]' : urunler|default, } %} {% set text = text|replace(replaced) %} {{ text|raw }} {% endmacro %} {%- macro getUrunler() -%} {% set carts = getUserCart() %} {% import "main/common/Macro/productVariantValues.html.twig" as productVariantValue %} {% for cart in carts %} {% set product = cart.product %} {% set productLang = getProductLang({'product':product}) %} {% set detailLink = path('main_product_show',{'id':product.id|default,'alias':productLang.alias|default}) %} {% set productVariant = getProductVariantInfo(product) %} {% set productPricing = productVariant.productPrice|default %} {% set productPrice = productPricing|product_price_customer %} {% set price = cart.qty * productPrice.price|default("0") %} {% endfor %}
Ürün Adet Fiyat
{{ productLang.name|default }} {{ productVariantValue.info(productVariant) }} {{ cart.qty|default }} adet {{ money_format(price|default) }} SAR
{% endmacro %} {%- macro generate(text) -%} {% set text = _self.replacedUser(text) %} {% set text = _self.replacedOrder(text) %} {{ text|unescape|raw }} {%- endmacro -%}