2023-06-21 15:47:06 +02:00
|
|
|
[{$smarty.block.parent}]
|
|
|
|
|
|
|
|
[{strip}]
|
|
|
|
<script>
|
|
|
|
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
2023-06-22 09:57:14 +02:00
|
|
|
[{assign var="gtmOrder" value=$oView->getOrder()}]
|
2023-06-22 10:37:09 +02:00
|
|
|
[{assign var="gtmBasket" value=$oView->getBasket()}]
|
2023-06-22 09:57:14 +02:00
|
|
|
[{assign var="gtmArticles" value=$gtmOrder->getOrderArticles()}]
|
|
|
|
[{assign var="gtmOrderVouchers" value=$gtmOrder->getVoucherNrList()}]
|
|
|
|
|
2023-06-21 15:47:06 +02:00
|
|
|
dataLayer.push({
|
|
|
|
'event': 'purchase',
|
|
|
|
'eventLabel':'Checkout Step 5',
|
|
|
|
'ecommerce': {
|
2023-06-22 09:57:14 +02:00
|
|
|
'transaction_id': '[{$gtmOrder->getFieldData("oxordernr")}]',
|
|
|
|
'affiliation': '[{$oxcmp_shop->getFieldData("oxname")}]',
|
|
|
|
'value': [{$gtmOrder->getTotalOrderSum()}],
|
|
|
|
'tax': [{math equation="x+y" x=$gtmOrder->getFieldData("oxartvatprice1") y=$gtmOrder->getFieldData("oxartvatprice2") }],
|
|
|
|
'shipping': [{$gtmOrder->getFieldData("oxdelcost")}],
|
|
|
|
'currency': '[{$gtmOrder->getFieldData('oxcurrency')}]',
|
2023-06-22 10:37:09 +02:00
|
|
|
'coupon': '[{foreach from=$gtmOrderVouchers item="gtmOrderVoucher" name="gtmOrderVoucherIteration"}][{$gtmOrderVoucher}][{if !$smarty.foreach.gtmOrderVoucherIteration.last}], [{/if}][{/foreach}]',
|
|
|
|
'paymentType': '[{$gtmBasket->getPaymentOnPaymentId()}]',
|
2023-06-22 09:57:14 +02:00
|
|
|
'items': [
|
2023-06-21 15:58:46 +02:00
|
|
|
[{foreach from=$gtmArticles item="gtmBasketItem" name="gtmArticles"}]
|
|
|
|
[{assign var="gtmPurchaseItemPriceObject" value=$gtmBasketItem->getPrice()}]
|
2023-06-22 09:39:03 +02:00
|
|
|
[{assign var="gtmPurchaseItem" value=$gtmBasketItem->getArticle()}]
|
|
|
|
[{assign var="gtmPurchaseItemCategory" value=$gtmPurchaseItem->getCategory()}]
|
|
|
|
|
2023-06-21 15:58:46 +02:00
|
|
|
{
|
|
|
|
'item_id': '[{$gtmBasketItem->getFieldData("oxartnum")}]',
|
|
|
|
'item_name': '[{$gtmBasketItem->getFieldData("oxtitle")}]',
|
|
|
|
'affiliation': '[{$gtmBasketItem->getFieldData("oxtitle")}]',
|
2023-06-22 09:57:14 +02:00
|
|
|
'coupon': '[{foreach from=$gtmOrderVouchers item="gtmOrderVoucher" name="gtmOrderVoucherIteration"}][{$gtmOrderVoucher}][{if !$smarty.foreach.gtmOrderVoucherIteration.last}], [{/if}][{/foreach}]',
|
2023-06-21 15:58:46 +02:00
|
|
|
'item_variant': '[{$gtmBasketItem->getFieldData("oxselvariant")}]',
|
2023-06-27 12:15:21 +02:00
|
|
|
[{if $gtmBasketItemCategory}]
|
2023-06-21 15:58:46 +02:00
|
|
|
'item_category': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(0)}]',
|
|
|
|
'item_category_2': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(1)}]',
|
|
|
|
'item_category_3': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(2)}]',
|
|
|
|
'item_category_4': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(3)}]',
|
|
|
|
'item_list_name': '[{$gtmPurchaseItemCategory->getSplitCategoryArray()}]',
|
2023-06-27 12:15:21 +02:00
|
|
|
[{/if}]
|
2023-06-21 15:58:46 +02:00
|
|
|
'price': [{$gtmPurchaseItemPriceObject->getPrice()}],
|
|
|
|
'quantity': [{$gtmBasketItem->getFieldData("oxamount")}],
|
|
|
|
'position': [{$smarty.foreach.gtmArticles.iteration}]
|
|
|
|
}[{if !$smarty.foreach.gtmArticles.last}],[{/if}]
|
2023-06-21 15:47:06 +02:00
|
|
|
[{/foreach}]
|
2023-06-22 09:57:14 +02:00
|
|
|
]
|
2023-06-21 15:47:06 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
[{/strip}]
|