Compare commits

...

8 Commits
1.1 ... 2.0

4 changed files with 37 additions and 29 deletions

View File

@ -1,8 +1,9 @@
[{$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()}]
<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': 'ee.impression', 'event': 'ee.impression',
@ -11,12 +12,12 @@
'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}]
@ -25,11 +26,12 @@
] ]
} }
}); });
</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}]

View File

@ -30,7 +30,10 @@ class ViewConfig extends ViewConfig_parent
{ {
if ($this->sContainerId === null) if ($this->sContainerId === null)
{ {
$this->sContainerId = $this->getConfig()->getConfigParam('vt_gtm_sContainerID'); $this->sContainerId = ContainerFactory::getInstance()
->getContainer()
->get(ModuleSettingBridgeInterface::class)
->get('vt_gtm_sContainerID', 'vt-gtm');
} }
return $this->sContainerId; return $this->sContainerId;
} }
@ -41,7 +44,10 @@ class ViewConfig extends ViewConfig_parent
{ {
if ($this->blGA4enabled === null) if ($this->blGA4enabled === null)
{ {
$this->sContainerId = $this->getConfig()->getConfigParam('vt_gtm_blEnableGA4'); $this->sContainerId = ContainerFactory::getInstance()
->getContainer()
->get(ModuleSettingBridgeInterface::class)
->get('vt_gtm_blEnableGA4', 'vt-gtm');
} }
return $this->blGA4enabled; return $this->blGA4enabled;
@ -81,7 +87,7 @@ class ViewConfig extends ViewConfig_parent
//'httpref' => $_SERVER["HTTP_REFERER"] ?? "unknown" //'httpref' => $_SERVER["HTTP_REFERER"] ?? "unknown"
]; ];
#return json_encode([$dataLayer], JSON_PRETTY_PRINT); return json_encode([$dataLayer], JSON_PRETTY_PRINT);
unset($dataLayer["user"]["http"]); // das brauchen wir hier nicht unset($dataLayer["user"]["http"]); // das brauchen wir hier nicht

View File

@ -45,7 +45,7 @@
}, },
"require": { "require": {
"php": ">=7.1", "php": ">=7.1",
"oxid-esales/oxideshop-ce": "v6.0 - 6.3", "oxid-esales/oxideshop-ce": "^6.5",
"google/apiclient":" ^2.0" "google/apiclient":" ^2.0"
}, },
"autoload": { "autoload": {

View File

@ -19,7 +19,7 @@ $aModule = [
Die Entwicklung basiert auf einem Fork von Marat Bedoev - <a href='https://github.com/vanilla-thunder/oxid-module-gtm'>Github-Link</a> Die Entwicklung basiert auf einem Fork von Marat Bedoev - <a href='https://github.com/vanilla-thunder/oxid-module-gtm'>Github-Link</a>
", ",
'thumbnail' => 'thumbnail.png', 'thumbnail' => 'thumbnail.png',
'version' => '1.0.0.0', 'version' => '2.0.0.0',
'author' => 'Data Development (Inh.: Thomas Dartsch)', 'author' => 'Data Development (Inh.: Thomas Dartsch)',
'email' => 'support@shopmodule.com', 'email' => 'support@shopmodule.com',
'url' => 'https://www.oxidmodule.com/', 'url' => 'https://www.oxidmodule.com/',