genuine reworking structure and aligning all

This commit is contained in:
MaxBUhe 2023-01-11 15:25:02 +01:00
parent c83e908da1
commit 664119f89e
2 changed files with 32 additions and 36 deletions

View File

@ -8,30 +8,28 @@
'event': 'purchase', 'event': 'purchase',
'eventLabel':'Checkout Step 5', 'eventLabel':'Checkout Step 5',
'ecommerce': { 'ecommerce': {
'purchase': { 'transaction_id':'[{$_gtmOrder->oxorder__oxordernr->value}]',
'actionField': { 'affiliation':'[{$oxcmp_shop->oxshops__oxname->value}]',
'id':'[{$_gtmOrder->oxorder__oxordernr->value}]', 'value':'[{$_gtmOrder->oxorder__oxtotalordersum->value}]',
'affiliation':'[{$oxcmp_shop->oxshops__oxname->value}]', 'tax':'[{math equation="x+y" x=$_gtmOrder->oxorder__oxartvatprice1->value y=$_gtmOrder->oxorder__oxartvatprice2->value }]',
'revenue':'[{$_gtmOrder->oxorder__oxtotalordersum->value}]', 'shipping':'[{$_gtmOrder->oxorder__oxdelcost->value}]',
'tax':'[{math equation="x+y" x=$_gtmOrder->oxorder__oxartvatprice1->value y=$_gtmOrder->oxorder__oxartvatprice2->value }]', 'currency': "[{$_gtmOrder->getFieldData('oxcurrency')}]"
'shipping':'[{$_gtmOrder->oxorder__oxdelcost->value}]', 'items':
'currency': "[{$_gtmOrder->getFieldData('oxcurrency')}]" [
}, [{foreach from=$_gtmArticles item="_gtmArticle" name="gtmArticles"}]
'products':[ {
[{foreach from=$_gtmArticles item="_gtmArticle" name="gtmArticles"}] 'id':'[{$_gtmArticle->oxorderarticles__oxartnum->value}]',
{ 'name': '[{$_gtmArticle->oxorderarticles__oxtitle->value}]',
'id':'[{$_gtmArticle->oxorderarticles__oxartnum->value}]', 'variant':'[{$_gtmArticle->oxorderarticles__oxselvariant->value}]',
'name': '[{$_gtmArticle->oxorderarticles__oxtitle->value}]', 'price': [{$_gtmArticle->oxorderarticles__oxprice->value}],
'variant':'[{$_gtmArticle->oxorderarticles__oxselvariant->value}]', 'quantity':[{$_gtmArticle->oxorderarticles__oxamount->value}],
'price': [{$_gtmArticle->oxorderarticles__oxprice->value}], 'position':[{$smarty.foreach.gtmArticles.iteration}]
'quantity':[{$_gtmArticle->oxorderarticles__oxamount->value}], }[{if !$smarty.foreach.gtmArticles.last}],[{/if}]
'position':[{$smarty.foreach.gtmArticles.iteration}] [{/foreach}]
}[{if !$smarty.foreach.gtmArticles.last}],[{/if}] ]
[{/foreach}]
]
} }
} }
}); })
</script> </script>
[{/strip}] [{/strip}]
[{$smarty.block.parent}] [{$smarty.block.parent}]

View File

@ -2,26 +2,24 @@
[{assign var="gtmProduct" value=$oView->getProduct()}] [{assign var="gtmProduct" value=$oView->getProduct()}]
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}] [{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}] [{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
[{strip}][{/strip}]
<script> <script>
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */ dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
dataLayer.push({ dataLayer.push({
'event': 'view_item', 'event': 'view_item',
'eventLabel':'Product View', 'eventLabel':'Product View',
'ecommerce': { 'ecommerce': {
'currencyCode': '[{$currency->name}]', 'currency': '[{$currency->name}]',
'detail': { 'items': [
'products': [ {
{ 'item_name': '[{$gtmProduct->oxarticles__oxtitle->value}]',
'name': '[{$gtmProduct->oxarticles__oxtitle->value}]', 'item_id': '[{$gtmProduct->oxarticles__oxartnum->value}]',
'id': '[{$gtmProduct->oxarticles__oxartnum->value}]', 'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
'price': [{$gtmProduct->oxarticles__oxprice->value}], 'item_category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
'brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]', 'item_variant': '[{if $gtmProduct->oxarticles__oxvarselect->value}][{$gtmProduct->oxarticles__oxvarselect->value}][{/if}]',
'category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]', 'price': [{$gtmProduct->oxarticles__oxprice->value}]
'variant': '[{if $gtmProduct->oxarticles__oxvarselect->value}][{$gtmProduct->oxarticles__oxvarselect->value}][{/if}]' }
} ]
]
}
} }
}); });
</script> </script>