# Conflicts: # Application/views/blocks/view_item.tpl # Application/views/ga4/add_to_cart.tpl
33 Zeilen
1.5 KiB
Smarty
33 Zeilen
1.5 KiB
Smarty
[{$smarty.block.parent}]
|
|
|
|
[{*$oxcmp_basket|get_class_methods|dumpvar*}]
|
|
|
|
[{assign var="d3BasketPrice" value=$oxcmp_basket->getPrice()}]
|
|
|
|
[{assign var='gtmCartArticles' value=$oView->getBasketArticles()}]
|
|
[{strip}][{capture assign=d3_ga4_view_cart}]
|
|
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
|
dataLayer.push({
|
|
'event': 'view_cart',
|
|
'eventLabel':'Checkout Step 1',
|
|
'ecommerce': {
|
|
'actionField': "step: 1",
|
|
'currency': "[{$currency->name}]",
|
|
'value': [{$d3BasketPrice->getPrice()}],
|
|
'items': [
|
|
[{foreach from=$oxcmp_basket->getContents() item=basketitem name=gtmCartContents key=basketindex}]
|
|
[{assign var="d3oItemPrice" value=$basketitem->getPrice()}]
|
|
{
|
|
'item_id': '[{$gtmCartArticles[$basketindex]->getFieldData('oxartnum')}]',
|
|
'item_name': '[{$gtmCartArticles[$basketindex]->getFieldData('oxtitle')}]',
|
|
'item_variant': '[{$gtmCartArticles[$basketindex]->getFieldData('oxvarselect')}]',
|
|
'price': [{$d3oItemPrice->getPrice()}],
|
|
'quantity':[{$basketitem->getAmount()}],
|
|
'position':[{$smarty.foreach.gtmCartContents.index}]
|
|
}[{if !$smarty.foreach.gtmCartContents.last}],[{/if}]
|
|
[{/foreach}]
|
|
]
|
|
}
|
|
});
|
|
[{/capture}][{/strip}]
|
|
[{oxscript add=$d3_ga4_view_cart}] |