switch view_item and item_list template

This commit is contained in:
MaxBUhe 2023-05-23 10:49:05 +02:00
parent f9a0834d26
commit 1d9e09b8b1
5 changed files with 30 additions and 69 deletions

View File

@ -1,25 +0,0 @@
[{$smarty.block.parent}]
[{assign var="gtmProduct" value=$oView->getProduct()}]
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
<script>
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
dataLayer.push({
'event': 'view_item',
'eventLabel':'Product View',
'ecommerce': {
'currency': '[{$currency->name}]',
'items': [
{
'item_name': '[{$gtmProduct->oxarticles__oxtitle->value}]',
'item_id': '[{$gtmProduct->oxarticles__oxartnum->value}]',
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
'item_category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
'item_variant': '[{if $gtmProduct->oxarticles__oxvarselect->value}][{$gtmProduct->oxarticles__oxvarselect->value}][{/if}]',
'price': [{$gtmProduct->oxarticles__oxprice->value}]
}
]
}
});
</script>

View File

@ -0,0 +1,26 @@
[{$smarty.block.parent}]
[{assign var="gtmProduct" value=$oView->getProduct()}]
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
<script>
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
dataLayer.push({
'event': 'view_item',
'eventLabel':'Product View',
'ecommerce': {
'currency': '[{$currency->name}]',
'items': [
{
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
'item_category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
'item_variant': '[{if $gtmProduct->getFieldData("oxvarselect")}][{$gtmProduct->getFieldData("oxvarselect")}][{/if}]',
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
'price': [{$d3PriceObject->getPrice()}]
}
]
}
});
</script>

View File

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

View File

@ -1,5 +1,5 @@
[{$smarty.block.parent}]
[{assign var="gtmProducts" value=$products}]
[{assign var="d3PriceObject" value=$gtmProducts->getPrice()}]
[{assign var="breadCrumb" value=''}]
@ -16,6 +16,7 @@
'item_list_name': '[{foreach from=$oView->getBreadCrumb() item=sCrum}][{if $sCrum.title }][{$breadCrumb|cat:$sCrum.title|cat:" > "}][{/if}][{/foreach}]',
'items': [
[{foreach from=$gtmProducts name="gtmProducts" item="gtmProduct"}]
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
[{if !$gtmCategory}][{assign var="gtmCategory" value=$gtmProduct->getCategory()}][{/if}]
{

View File

@ -43,17 +43,11 @@ $aModule = [
'block' => 'theme_svg_icons',
'file' => '/Application/views/blocks/_gtm_nojs.tpl'
],
// widget_product_list
[
'template' => 'widget/product/list.tpl',
'block' => 'widget_product_list',
'file' => '/Application/views/blocks/widget_product_list.tpl'
],
// details
[
'template' => 'page/details/inc/productmain.tpl',
'block' => 'details_productmain_title',
'file' => '/Application/views/blocks/detail.tpl',
'file' => '/Application/views/blocks/view_item.tpl',
'position' => 150
],
// checkout
@ -71,7 +65,7 @@ $aModule = [
// view_item_list
[
'template' => 'widget/product/list.tpl',
'block' => 'd3Ga4_view_item_list',
'block' => 'widget_product_list',
'file' => '/Application/views/ga4/view_item_list.tpl',
'position' => 150
],