ein paar fixes

This commit is contained in:
vanilla-thunder 2018-12-04 15:53:10 +01:00
parent 1deb3a635a
commit 6498d7477f
5 changed files with 44 additions and 39 deletions

View File

@ -1,40 +1,44 @@
[{strip}] [{strip}]
[{assign var="_cur" value=$oView->getActCurrency()}] [{assign var="_cur" value=$oView->getActCurrency()}]
[{assign var="_product" value=$oView->getProduct()}] [{assign var="_tmProduct" value=$oView->getProduct()}]
[{assign var="_manufacturer" value=$_product->getManufacturer()}] [{assign var="_tmManufacturer" value=$_tmProduct->getManufacturer()}]
[{assign var="_category" value=$_product->getCategory()}] [{assign var="_tmCategory" value=$_tmProduct->getCategory()}]
<script type="text/javascript"> <script type="text/javascript">
var _products = [ var _products = [
{ {
'name': '[{$_product->oxarticles__oxtitle->value}]', 'name': '[{$_tmProduct->oxarticles__oxtitle->value}]',
'variant':'[{$_product->oxarticles__oxvarselect->value}]', [{if $_tmProduct->oxarticles__oxvarselect->value}]'variant':'[{$_tmProduct->oxarticles__oxvarselect->value}]',[{/if}]
'id': '[{$_product->oxarticles__oxartnum->value}]', 'id': '[{$_tmProduct->oxarticles__oxartnum->value}]',
'price': [{$_product->oxarticles__oxprice->value}], 'price': [{$_tmProduct->oxarticles__oxprice->value}],
[{if $_manufacturer}]'brand':'[{$_manufacturer->oxmanufacturers__oxtitle->value}]',[{/if}] [{if $_tmManufacturer}]'brand':'[{$_tmManufacturer->oxmanufacturers__oxtitle->value}]',[{/if}]
'category': '[{if _category}][{$_category->getLink()|replace:$oViewConf->getHomeLink():""|rtrim:"/"}][{else}]-[{/if}]' 'category': '[{if $_tmCategory}][{$_tmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]'
} }
]; ];
if(typeof document.referrer !== "undefined" && document.referrer.indexOf("[{$oViewConf->getHomeLink()}]") === 0) var getRefPath = function() {
{ var l = document.createElement("a");
var _ref = document.referrer.replace("[{$oViewConf->getHomeLink()}]",""); l.href = document.referrer;
if( _ref.indexOf('?') > -1 ) _ref = _ref.substring(0,_ref.indexOf('?')); return l.pathname;
};
if( _ref.lastIndexOf('/') === (_ref.length-1) ) if( typeof document.referrer !== "undefined"
{ && document.referrer.indexOf(document.location.hostname) !== -1 /* Besucher ist von hier */
console.log("jap, der kommt von hier!"); /*&& getRefPath() !== "/index.php" */
dataLayer.push({ && document.location.pathname !== "/index.php"
'event': 'ee.click', && getRefPath() !== document.location.pathname)
'eventLabel':'Click', {
'ecommerce': { /*console.log("jap, der kommt von hier!");*/
'currencyCode': '[{$_cur->name}]', dataLayer.push({
'click': { 'event': 'ee.click',
'actionField': {'list': _ref.replace(/\/$/, "")}, 'eventLabel':'Click',
'products': _products 'ecommerce': {
} 'currencyCode': '[{$_cur->name}]',
'click': {
'actionField': {'list': getRefPath().replace(/^\//, "").replace(/\/$/, "")},
'products': _products
} }
}); }
} });
} }
dataLayer.push({ dataLayer.push({
'event':'ee.product', 'event':'ee.product',

View File

@ -14,18 +14,18 @@
{ {
'name': '[{$_tmProduct->oxarticles__oxtitle->value}]', 'name': '[{$_tmProduct->oxarticles__oxtitle->value}]',
'id': '[{$_tmProduct->oxarticles__oxartnum->value}]', 'id': '[{$_tmProduct->oxarticles__oxartnum->value}]',
'price': '[{$_tmProduct->oxarticles__oxprice->value}]', 'price': [{$_tmProduct->oxarticles__oxprice->value}],
'category': '[{if $_category}][{$_category->getLink()|replace:$oViewConf->getHomeLink():""|rtrim:"/"}][{else}]-[{/if}]', 'category': '[{if $_tmCategory}][{$_tmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
[{if $listId == 'productList' || $listId == 'categoryList'}] [{if $listId == 'productList' || $listId == 'categoryList'}]
[{if $oViewConf->getGTMproductListPerformanceSetting() == "1"}] [{if $oViewConf->getGTMproductListPerformanceSetting() == "1"}]
'list': '[{oxmultilang ident="CATEGORIES"}]' 'list': '[{oxmultilang ident="CATEGORIES"}]',
[{elseif $oViewConf->getGTMproductListPerformanceSetting() == "2"}] [{elseif $oViewConf->getGTMproductListPerformanceSetting() == "2"}]
'list': '[{if $_tmCategory}][{$_tmCategory->getLink()|replace:$oViewConf->getHomeLink():""|rtrim:"/"}][{else}]-[{/if}]' 'list': '[{if $_tmCategory}][{$_tmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
[{/if}] [{/if}]
[{else}] [{else}]
'list': '[{$listId|default:$oView->getClassName()}]' 'list': '[{$listId|default:$oView->getClassName()}]',
[{/if}] [{/if}]
[{*'position': [{$smarty.foreach.productlist.iteration|default:1}]*}] 'position': [{$smarty.foreach.productlist.iteration|default:1}]
} }
] ]
} }

View File

@ -3,17 +3,17 @@
<script> <script>
dataLayer.push({ dataLayer.push({
"event":"ee.checkout", "event":"ee.checkout",
'eventLabel':'Checkout 1',
"ecommerce": { "ecommerce": {
"checkout": { "checkout": {
"actionField": {"step":1}, "actionField": {"step":1},
"products": [ "products": [
[{foreach key=basketindex from=$oxcmp_basket->getContents() item=basketitem name=gtmCartContents}] [{foreach key=basketindex from=$oxcmp_basket->getContents() item=basketitem name=gtmCartContents}]
[{assign var="_price" value=$basketitem->getPrice()}]
{ {
'id':'[{$gtmCartArticles[$basketindex]->oxarticles__oxartnum->value}]', 'id':'[{$gtmCartArticles[$basketindex]->oxarticles__oxartnum->value}]',
'name': '[{$gtmCartArticles[$basketindex]->oxarticles__oxtitle->value}]', 'name': '[{$gtmCartArticles[$basketindex]->oxarticles__oxtitle->value}]',
'variant':'[{$gtmCartArticles[$basketindex]->oxarticles__oxvarselect->value}]', 'variant':'[{$gtmCartArticles[$basketindex]->oxarticles__oxvarselect->value}]',
'price': '[{$basketitem->getFTotalPrice()|replace:",":"."}]', 'price': [{$_price->getPrice()}],
'quantity':[{$basketitem->getAmount()}], 'quantity':[{$basketitem->getAmount()}],
'position':[{$smarty.foreach.gtmCartContents.index}] 'position':[{$smarty.foreach.gtmCartContents.index}]
}[{if !$smarty.foreach.gtmCartContents.last}],[{/if}] }[{if !$smarty.foreach.gtmCartContents.last}],[{/if}]

View File

@ -25,14 +25,15 @@
}, },
'products':[ 'products':[
[{foreach key="_index" from=$_gtmBasket->getContents() item="_gtmBasketitem" name="gtmTransactionProducts"}] [{foreach key="_index" from=$_gtmBasket->getContents() item="_gtmBasketitem" name="gtmTransactionProducts"}]
[{assign var="_price" value=$basketitem->getPrice()}]
{ {
'id':'[{$_gtmArticles[$_index]->oxarticles__oxartnum->value}]', 'id':'[{$_gtmArticles[$_index]->oxarticles__oxartnum->value}]',
'name': '[{$_gtmArticles[$_index]->oxarticles__oxtitle->value}]', 'name': '[{$_gtmArticles[$_index]->oxarticles__oxtitle->value}]',
'variant':'[{$_gtmArticles[$_index]->oxarticles__oxvarselect->value}]', 'variant':'[{$_gtmArticles[$_index]->oxarticles__oxvarselect->value}]',
'price': '[{$_gtmBasketitem->getFTotalPrice()|replace:",":"."}]', 'price': [{$_price->getPrice()}],
'item_price': '[{$_gtmBasketitem->getFTotalPrice()|replace:",":"."}]', 'item_price': [{$_price->getPrice()}],
'quantity':[{$_gtmBasketitem->getAmount()}], 'quantity':[{$_gtmBasketitem->getAmount()}],
'position':[{$smarty.foreach.gtmTransactionProducts.index}] 'position':[{$smarty.foreach.gtmTransactionProducts.iteration}]
}[{if !$smarty.foreach.gtmTransactionProducts.last}],[{/if}] }[{if !$smarty.foreach.gtmTransactionProducts.last}],[{/if}]
[{/foreach}] [{/foreach}]
] ]

View File

@ -63,7 +63,7 @@ $aModule = [
'block' => 'theme_svg_icons', 'block' => 'theme_svg_icons',
'file' => '/application/views/blocks/theme_svg_icons.tpl' 'file' => '/application/views/blocks/theme_svg_icons.tpl'
], ],
// detail + add to cart // detail + click + add to basket
[ [
'template' => 'page/details/inc/productmain.tpl', 'template' => 'page/details/inc/productmain.tpl',
'block' => 'details_productmain_title', 'block' => 'details_productmain_title',