2018-07-04 15:47:37 +02:00
|
|
|
[{strip}]
|
|
|
|
[{assign var="gtmCartArticles" value=$oView->getBasketArticles()}]
|
|
|
|
<script>
|
2021-07-17 23:22:23 +02:00
|
|
|
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null});
|
2018-07-04 15:47:37 +02:00
|
|
|
dataLayer.push({
|
2021-07-17 23:22:23 +02:00
|
|
|
"event":"enhanced-ecommerce",
|
2018-07-04 15:47:37 +02:00
|
|
|
"ecommerce": {
|
|
|
|
"checkout": {
|
|
|
|
"actionField": {"step":1},
|
|
|
|
"products": [
|
|
|
|
[{foreach key=basketindex from=$oxcmp_basket->getContents() item=basketitem name=gtmCartContents}]
|
2018-12-04 15:53:10 +01:00
|
|
|
[{assign var="_price" value=$basketitem->getPrice()}]
|
2018-07-04 15:47:37 +02:00
|
|
|
{
|
|
|
|
'id':'[{$gtmCartArticles[$basketindex]->oxarticles__oxartnum->value}]',
|
|
|
|
'name': '[{$gtmCartArticles[$basketindex]->oxarticles__oxtitle->value}]',
|
|
|
|
'variant':'[{$gtmCartArticles[$basketindex]->oxarticles__oxvarselect->value}]',
|
2018-12-04 15:53:10 +01:00
|
|
|
'price': [{$_price->getPrice()}],
|
2018-07-04 15:47:37 +02:00
|
|
|
'quantity':[{$basketitem->getAmount()}],
|
|
|
|
'position':[{$smarty.foreach.gtmCartContents.index}]
|
|
|
|
}[{if !$smarty.foreach.gtmCartContents.last}],[{/if}]
|
|
|
|
[{/foreach}]
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
var gtmCartContents = {
|
|
|
|
[{foreach key=basketindex from=$oxcmp_basket->getContents() item=basketitem name=gtmCartContents}]
|
|
|
|
'[{$basketindex}]':{
|
|
|
|
'id':'[{$gtmCartArticles[$basketindex]->oxarticles__oxartnum->value}]'
|
|
|
|
}[{if !$smarty.foreach.gtmCartContents.last}],[{/if}]
|
|
|
|
[{/foreach}]
|
|
|
|
};
|
|
|
|
|
|
|
|
[{capture name="removeFromBasket"}]
|
|
|
|
$("#basketRemove").on("click", function() {
|
|
|
|
var _checked = [],
|
|
|
|
_products = [];
|
|
|
|
|
|
|
|
$("input:checkbox:checked[name^='aproducts'][name*='remove']").each(function() { _checked.push($(this).attr('name').replace("aproducts[","").replace("][remove]","")); });
|
|
|
|
if(_checked.length == 0) return;
|
|
|
|
_checked.forEach(function(_oxid) { _products.push({ 'id':gtmCartContents[_oxid].id}) });
|
|
|
|
|
|
|
|
dataLayer.push({
|
|
|
|
'event':'ee.removeFromCart',
|
|
|
|
'ecommerce': {
|
|
|
|
'currencyCode': '[{$currency->name}]',
|
|
|
|
'remove': {
|
|
|
|
'products': _products
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
/*
|
|
|
|
|
|
|
|
*/
|
|
|
|
[{/capture}]
|
|
|
|
[{oxscript add=$smarty.capture.removeFromBasket}]
|
|
|
|
</script>
|
|
|
|
[{/strip}]
|
|
|
|
[{$smarty.block.parent}]
|