fix bug that'd fail in wave and fail iIndex

This commit is contained in:
MaxBUhe 2022-12-09 14:51:45 +01:00
parent ed767efa8a
commit a1dc0a6a58

View File

@ -1,35 +1,37 @@
[{$smarty.block.parent}] [{$smarty.block.parent}]
[{assign var="gtmProduct" value=$oView->getProduct()}] [{assign var="gtmProduct" value=$oView->getProduct()}]
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}] [{if $gtmProduct}]
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}] [{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
<script> [{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */ <script>
dataLayer.push({ dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
dataLayer.push({
'event': 'ee.impression', 'event': 'ee.impression',
'eventLabel':'Impression', 'eventLabel':'Impression',
'ecommerce': { 'ecommerce': {
'currencyCode': '[{$currency->name}]', 'currencyCode': '[{$currency->name}]',
'impressions': [ 'impressions': [
{ {
'name': '[{$gtmProduct->oxarticles__oxtitle->value}]', 'name': '[{$gtmProduct->getFieldData('oxtitle')}]',
'id': '[{$gtmProduct->oxarticles__oxartnum->value}]', 'id': '[{$gtmProduct->getFieldData('oxartnum')}]',
'price': [{$gtmProduct->oxarticles__oxprice->value}], 'price': [{$gtmProduct->getFieldData('oxprice')}],
'brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]', 'brand': '[{if $gtmManufacturer}][{$gtmManufacturer->getFieldData('oxtitle')}][{/if}]',
'category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]', 'category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
'variant': '[{if $gtmProduct->oxarticles__oxvarselect->value}][{$gtmProduct->oxarticles__oxvarselect->value}][{/if}]' 'variant': '[{if $gtmProduct->getFieldData('oxvarselect')}][{$gtmProduct->getFieldData('oxvarselect')}][{/if}]'
[{if $list && $position}], [{if $list && $position}],
'list': '[{$list}]', 'list': '[{$list}]',
'position': [{"_"|str_replace:"":$position}] 'position': [{"_"|str_replace:"":$position}]
[{/if}] [{/if}]
} }
] ]
} }
}); });
</script> </script>
<!-- <!--
sWidgetType [{$sWidgetType}] | [{$oView->getViewParameter('sWidgetType')}] sWidgetType [{$sWidgetType}] | [{$oView->getViewParameter('sWidgetType')}]
sListType [{$sListType}] | [{$oView->getViewParameter('sListType')}] sListType [{$sListType}] | [{$oView->getViewParameter('sListType')}]
iIndex [{$iIndex}] | [{$oView->getIndex()}] iIndex [{$iIndex}] | [{$oView->getViewParameter('iIndex')}]
listId [{$listId}] | [{$oView->getViewParameter('listId')}] listId [{$listId}] | [{$oView->getViewParameter('listId')}]
testid [{$testid}] | [{$oView->getViewParameter('testid')}] testid [{$testid}] | [{$oView->getViewParameter('testid')}]
--> -->
[{/if}]