diff --git a/Application/views/blocks/checkout_s1.tpl b/Application/views/blocks/checkout_s1.tpl index 9123e19..d488548 100644 --- a/Application/views/blocks/checkout_s1.tpl +++ b/Application/views/blocks/checkout_s1.tpl @@ -1,57 +1,31 @@ -[{strip}] - [{assign var='gtmCartArticles' value=$oView->getBasketArticles()}] - -[{/strip}] -[{$smarty.block.parent}] \ No newline at end of file +[{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': [{$oxcmp_basket->getBruttoSum()}], + 'items': [ + [{foreach from=$oxcmp_basket->getContents() item=basketitem name=gtmCartContents key=basketindex}] + [{assign var='_price' value=$basketitem->getUnitPrice()}] + { + 'item_id': '[{$gtmCartArticles[$basketindex]->oxarticles__oxartnum->value}]', + 'item_name': '[{$gtmCartArticles[$basketindex]->oxarticles__oxtitle->value}]', + 'item_variant': '[{$gtmCartArticles[$basketindex]->oxarticles__oxvarselect->value}]', + 'price': [{$_price->getPrice()}], + 'quantity':[{$basketitem->getAmount()}], + 'position':[{$smarty.foreach.gtmCartContents.index}] + }[{if !$smarty.foreach.gtmCartContents.last}],[{/if}] + [{/foreach}] + ] + } + }); +[{/capture}][{/strip}] +[{oxscript add=$d3_ga4_view_cart}] \ No newline at end of file