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

View File

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

View File

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

View File

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

View File

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