implementing Category->getSplitCategoryArray() method for category-step

This commit is contained in:
MaxBUhe 2023-06-21 15:43:43 +02:00
parent 92a91d0194
commit 47b8622018
2 changed files with 7 additions and 4 deletions

View File

@ -15,13 +15,17 @@
[{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}]
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
{
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
'price': [{$d3PriceObject->getPrice()}],
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
'item_category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
'item_category': '[{$gtmCategory->getSplitCategoryArray(0)}]',
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1)}]',
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2)}]',
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3)}]',
'item_list_name':'[{$gtmCategory->getSplitCategoryArray()}]',
'quantity': 1
}[{if !$smarty.foreach.gtmProducts.last}],[{/if}]
[{/foreach}]

View File

@ -31,7 +31,6 @@ $aModule = [
'templates' => [
// GA4 events
'ga4_add_to_cart.tpl' => 'd3/googleanalytics4/Application/views/ga4/add_to_cart.tpl',
'ga4_search.tpl' => 'd3/googleanalytics4/Application/views/ga4/search.tpl',
'ga4_view_item_list.tpl' => 'd3/googleanalytics4/Application/views/ga4/view_item_list.tpl',
],
'blocks' => [
@ -78,7 +77,7 @@ $aModule = [
[
'template' => 'page/search/search.tpl',
'block' => 'search_results',
'file' => '/Application/views/ga4/search.tpl',
'file' => '/Application/views/ga4/view_search_result.tpl',
'position' => 150
],
// add_to_cart