Merge remote-tracking branch 'remotes/origin/rel_1.x'
This commit is contained in:
commit
7d23204841
@ -0,0 +1,3 @@
|
||||
[{$smarty.block.parent}]
|
||||
|
||||
[{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]
|
3
Application/views/blocks/page_list_listbody.tpl
Normal file
3
Application/views/blocks/page_list_listbody.tpl
Normal file
@ -0,0 +1,3 @@
|
||||
[{$smarty.block.parent}]
|
||||
|
||||
[{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]
|
@ -1,56 +1,3 @@
|
||||
[{$smarty.block.parent}]
|
||||
|
||||
[{block name="d3_ga4_purchase_block"}]
|
||||
[{capture assign=d3_ga4_purchase}]
|
||||
[{strip}]
|
||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||
[{assign var="gtmOrder" value=$oView->getOrder()}]
|
||||
[{assign var="gtmBasket" value=$oView->getBasket()}]
|
||||
[{assign var="gtmArticles" value=$gtmOrder->getOrderArticles()}]
|
||||
[{assign var="gtmOrderVouchers" value=$gtmOrder->getVoucherNrList()}]
|
||||
|
||||
dataLayer.push({
|
||||
'event': 'purchase',
|
||||
'eventLabel':'Checkout Step 5',
|
||||
'ecommerce': {
|
||||
'transaction_id': '[{$gtmOrder->getFieldData("oxordernr")}]',
|
||||
'affiliation': '[{$oxcmp_shop->getFieldData("oxname")}]',
|
||||
'value': [{$gtmOrder->getTotalOrderSum()}],
|
||||
'tax': [{math equation="x+y" x=$gtmOrder->getFieldData("oxartvatprice1") y=$gtmOrder->getFieldData("oxartvatprice2") }],
|
||||
'shipping': [{$gtmOrder->getFieldData("oxdelcost")}],
|
||||
'currency': '[{$gtmOrder->getFieldData('oxcurrency')}]',
|
||||
'coupon': '[{foreach from=$gtmOrderVouchers item="gtmOrderVoucher" name="gtmOrderVoucherIteration"}][{$gtmOrderVoucher}][{if !$smarty.foreach.gtmOrderVoucherIteration.last}], [{/if}][{/foreach}]',
|
||||
'paymentType': '[{$gtmBasket->getPaymentOnPaymentId()}]',
|
||||
'items': [
|
||||
[{foreach from=$gtmArticles item="gtmBasketItem" name="gtmArticles"}]
|
||||
[{assign var="gtmPurchaseItemPriceObject" value=$gtmBasketItem->getPrice()}]
|
||||
[{assign var="gtmPurchaseItem" value=$gtmBasketItem->getArticle()}]
|
||||
[{assign var="gtmPurchaseItemCategory" value=$gtmPurchaseItem->getCategory()}]
|
||||
|
||||
{
|
||||
'item_id': '[{$gtmBasketItem->getFieldData("oxartnum")}]',
|
||||
'item_name': '[{$gtmBasketItem->getFieldData("oxtitle")}]',
|
||||
'affiliation': '[{$gtmBasketItem->getFieldData("oxtitle")}]',
|
||||
'coupon': '[{foreach from=$gtmOrderVouchers item="gtmOrderVoucher" name="gtmOrderVoucherIteration"}][{$gtmOrderVoucher}][{if !$smarty.foreach.gtmOrderVoucherIteration.last}], [{/if}][{/foreach}]',
|
||||
'item_variant': '[{$gtmBasketItem->getFieldData("oxselvariant")}]',
|
||||
[{if $gtmPurchaseItemCategory}]
|
||||
'item_category': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(0)}]',
|
||||
'item_category_2': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(1)}]',
|
||||
'item_category_3': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(2)}]',
|
||||
'item_category_4': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(3)}]',
|
||||
'item_list_name': '[{$gtmPurchaseItemCategory->getSplitCategoryArray()}]',
|
||||
[{/if}]
|
||||
'price': [{$gtmPurchaseItemPriceObject->getPrice()}],
|
||||
'quantity': [{$gtmBasketItem->getFieldData("oxamount")}],
|
||||
'position': [{$smarty.foreach.gtmArticles.iteration}]
|
||||
}[{if !$smarty.foreach.gtmArticles.last}],[{/if}]
|
||||
[{/foreach}]
|
||||
]
|
||||
}[{if $oViewConf->isDebugModeOn()}],
|
||||
'debug_mode': 'true'
|
||||
[{/if}]
|
||||
})
|
||||
[{/strip}]
|
||||
[{/capture}]
|
||||
[{oxscript add=$d3_ga4_purchase}]
|
||||
[{/block}]
|
||||
[{include file="event/purchase.tpl"}]
|
3
Application/views/blocks/remove_from_cart.tpl
Normal file
3
Application/views/blocks/remove_from_cart.tpl
Normal file
@ -0,0 +1,3 @@
|
||||
[{$smarty.block.parent}]
|
||||
|
||||
[{include file="event/remove_from_cart.tpl"}]
|
3
Application/views/blocks/start_welcome_text.tpl
Normal file
3
Application/views/blocks/start_welcome_text.tpl
Normal file
@ -0,0 +1,3 @@
|
||||
[{$smarty.block.parent}]
|
||||
|
||||
[{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]
|
@ -1,50 +1,3 @@
|
||||
[{$smarty.block.parent}]
|
||||
|
||||
[{*$oxcmp_basket|get_class_methods|dumpvar*}]
|
||||
|
||||
[{assign var="d3BasketPrice" value=$oxcmp_basket->getPrice()}]
|
||||
[{assign var='gtmCartArticles' value=$oView->getBasketArticles()}]
|
||||
|
||||
[{block name="d3_ga4_view_cart_block"}]
|
||||
[{capture assign=d3_ga4_view_cart}]
|
||||
[{strip}]
|
||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||
dataLayer.push({
|
||||
'event': 'view_cart',
|
||||
'eventLabel':'Checkout Step 1',
|
||||
'ecommerce': {
|
||||
'actionField': "step: 1",
|
||||
'currency': "[{$currency->name}]",
|
||||
'value': [{$d3BasketPrice->getPrice()}],
|
||||
'coupon': '[{foreach from=$oxcmp_basket->getVouchers() item=sVoucher key=key name=Voucher}][{$sVoucher->sVoucherNr}][{if !$smarty.foreach.Voucher.last}], [{/if}][{/foreach}]',
|
||||
'items': [
|
||||
[{foreach from=$oxcmp_basket->getContents() item=basketitem name=gtmCartContents key=basketindex}]
|
||||
[{assign var="d3oItemPrice" value=$basketitem->getPrice()}]
|
||||
[{assign var="gtmBasketItem" value=$basketitem->getArticle()}]
|
||||
[{assign var="gtmBasketItemCategory" value=$gtmBasketItem->getCategory()}]
|
||||
{
|
||||
'item_id': '[{$gtmCartArticles[$basketindex]->getFieldData('oxartnum')}]',
|
||||
'item_name': '[{$gtmCartArticles[$basketindex]->getFieldData('oxtitle')}]',
|
||||
'item_variant': '[{$gtmCartArticles[$basketindex]->getFieldData('oxvarselect')}]',
|
||||
[{if $gtmBasketItemCategory}]
|
||||
'item_category': '[{$gtmBasketItemCategory->getSplitCategoryArray(0)}]',
|
||||
'item_category_2': '[{$gtmBasketItemCategory->getSplitCategoryArray(1)}]',
|
||||
'item_category_3': '[{$gtmBasketItemCategory->getSplitCategoryArray(2)}]',
|
||||
'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3)}]',
|
||||
'item_list_name': '[{$gtmBasketItemCategory->getSplitCategoryArray()}]',
|
||||
[{/if}]
|
||||
'price': [{$d3oItemPrice->getPrice()}],
|
||||
'coupon': '[{foreach from=$oxcmp_basket->getVouchers() item=sVoucher key=key name=Voucher}][{$sVoucher->sVoucherNr}][{if !$smarty.foreach.Voucher.last}], [{/if}][{/foreach}]',
|
||||
'quantity': [{$basketitem->getAmount()}],
|
||||
'position': [{$smarty.foreach.gtmCartContents.index}]
|
||||
}[{if !$smarty.foreach.gtmCartContents.last}],[{/if}]
|
||||
[{/foreach}]
|
||||
]
|
||||
}[{if $oViewConf->isDebugModeOn()}],
|
||||
'debug_mode': 'true'
|
||||
[{/if}]
|
||||
});
|
||||
[{/strip}]
|
||||
[{/capture}]
|
||||
[{oxscript add=$d3_ga4_view_cart}]
|
||||
[{/block}]
|
||||
[{include file="event/view_cart.tpl"}]
|
@ -1,40 +1,3 @@
|
||||
[{$smarty.block.parent}]
|
||||
[{assign var="gtmProduct" value=$oView->getProduct()}]
|
||||
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
|
||||
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
|
||||
|
||||
[{block name="d3_ga4_view_item_block"}]
|
||||
[{capture assign=d3_ga4_view_item}]
|
||||
[{strip}]
|
||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||
|
||||
dataLayer.push({
|
||||
'event': 'view_item',
|
||||
'eventLabel':'Product View',
|
||||
'ecommerce': {
|
||||
'currency': '[{$currency->name}]',
|
||||
'items': [
|
||||
{
|
||||
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
|
||||
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
|
||||
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
||||
'item_variant': '[{if $gtmProduct->getFieldData("oxvarselect")}][{$gtmProduct->getFieldData("oxvarselect")}][{/if}]',
|
||||
[{if $gtmCategory}]
|
||||
'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()}]',
|
||||
[{/if}]
|
||||
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
|
||||
'price': [{$d3PriceObject->getPrice()}]
|
||||
}
|
||||
]
|
||||
}[{if $oViewConf->isDebugModeOn()}],
|
||||
'debug_mode': 'true'
|
||||
[{/if}]
|
||||
});
|
||||
[{/strip}]
|
||||
[{/capture}]
|
||||
[{oxscript add=$d3_ga4_view_item}]
|
||||
[{/block}]
|
||||
[{include file="event/view_item.tpl"}]
|
3
Application/views/blocks/view_item_list.tpl
Normal file
3
Application/views/blocks/view_item_list.tpl
Normal file
@ -0,0 +1,3 @@
|
||||
[{$smarty.block.parent}]
|
||||
|
||||
[{include file="event/view_item_list.tpl"}]
|
3
Application/views/blocks/view_search_result.tpl
Normal file
3
Application/views/blocks/view_search_result.tpl
Normal file
@ -0,0 +1,3 @@
|
||||
[{$smarty.block.parent}]
|
||||
|
||||
[{include file="event/view_search_result.tpl"}]
|
61
Application/views/event/add_to_cart.tpl
Normal file
61
Application/views/event/add_to_cart.tpl
Normal file
@ -0,0 +1,61 @@
|
||||
|
||||
[{if $d3CmpBasket->getAddToBasketDecision() && $d3CmpBasket->d3GtmRequestedArticleLoadedByAnid() !== null}]
|
||||
[{assign var="oGtmProduct" value=$d3CmpBasket->d3GtmRequestedArticleLoadedByAnid()}]
|
||||
[{assign var="oGtmAmountArticlesAdded" value=$d3CmpBasket->getD3GtmAddToCartAmountArticles()}]
|
||||
[{*$smarty.block.parent*}]
|
||||
[{* variable $oGtmProduct is passed from parent tempalte *}]
|
||||
[{assign var="d3PriceObject" value=$oGtmProduct->getPrice()}]
|
||||
[{assign var="gtmCurrency" value=$oView->getActCurrency()}]
|
||||
[{assign var="gtmManufacturer" value=$oGtmProduct->getManufacturer()}]
|
||||
[{assign var="gtmCategory" value=$oGtmProduct->getCategory()}]
|
||||
|
||||
[{block name="d3_ga4_add_to_cart_list_block"}]
|
||||
[{capture name="d3_ga4_add_to_cart_listtpl"}]
|
||||
[{strip}]
|
||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||
|
||||
[{*** Debug cases ***}]
|
||||
[{*event.preventDefault();*}]
|
||||
|
||||
let iArtQuantity = $("[{$htmlIdAmountOfArticles}]").val();
|
||||
let iArtQuantityAdded = [{$oGtmAmountArticlesAdded}];
|
||||
|
||||
if(!iArtQuantity && (iArtQuantityAdded === 1)){
|
||||
iArtQuantity = 1;
|
||||
}else{
|
||||
iArtQuantity = iArtQuantityAdded;
|
||||
}
|
||||
|
||||
dataLayer.push({
|
||||
'isAddToBasket': true,
|
||||
'event':'add_to_cart',
|
||||
'eventLabel': 'add_to_cart',
|
||||
'ecommerce': {
|
||||
'currency': "[{$currency->name}]",
|
||||
'value': iArtQuantity*[{$d3PriceObject->getPrice()}],
|
||||
'items': [
|
||||
{
|
||||
'item_id': '[{$oGtmProduct->getFieldData('oxartnum')}]',
|
||||
'item_name': '[{$oGtmProduct->getFieldData('oxtitle')}]',
|
||||
'price': [{$d3PriceObject->getPrice()}],
|
||||
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
||||
'item_variant': '[{if $oGtmProduct->getFieldData('oxvarselect')}][{$oGtmProduct->getFieldData('oxvarselect')}][{/if}]',
|
||||
[{if $gtmCategory}]
|
||||
'item_category': '[{$gtmCategory->getSplitCategoryArray(0, true)}]',
|
||||
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1, true)}]',
|
||||
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2, true)}]',
|
||||
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3, true)}]',
|
||||
'item_list_name':'[{$gtmCategory->getSplitCategoryArray()}]',
|
||||
[{/if}]
|
||||
'quantity': iArtQuantity
|
||||
}
|
||||
]
|
||||
}[{if $oViewConf->isDebugModeOn()}],
|
||||
'debug_mode': 'true'
|
||||
[{/if}]
|
||||
});
|
||||
[{/strip}]
|
||||
[{/capture}]
|
||||
[{oxscript add=$smarty.capture.d3_ga4_add_to_cart_listtpl}]
|
||||
[{/block}]
|
||||
[{/if}]
|
56
Application/views/event/purchase.tpl
Normal file
56
Application/views/event/purchase.tpl
Normal file
@ -0,0 +1,56 @@
|
||||
[{block name="d3_ga4_purchase_block"}]
|
||||
[{capture name="d3_ga4_purchase"}]
|
||||
[{strip}]
|
||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||
[{assign var="gtmOrder" value=$oView->getOrder()}]
|
||||
[{assign var="gtmBasket" value=$oView->getBasket()}]
|
||||
[{assign var="gtmArticles" value=$gtmOrder->getOrderArticles()}]
|
||||
[{assign var="gtmOrderVouchers" value=$gtmOrder->getVoucherNrList()}]
|
||||
|
||||
dataLayer.push({
|
||||
'event': 'purchase',
|
||||
'eventLabel':'Checkout Step 5',
|
||||
'ecommerce':
|
||||
{
|
||||
'transaction_id': '[{$gtmOrder->getFieldData("oxordernr")}]',
|
||||
'affiliation': '[{$oxcmp_shop->getFieldData("oxname")}]',
|
||||
'value': [{$gtmOrder->getTotalOrderSum()}],
|
||||
'tax': [{math equation="x+y" x=$gtmOrder->getFieldData("oxartvatprice1") y=$gtmOrder->getFieldData("oxartvatprice2") }],
|
||||
'shipping': [{$gtmOrder->getFieldData("oxdelcost")}],
|
||||
'currency': '[{$gtmOrder->getFieldData('oxcurrency')}]',
|
||||
'coupon': '[{foreach from=$gtmOrderVouchers item="gtmOrderVoucher" name="gtmOrderVoucherIteration"}][{$gtmOrderVoucher}][{if !$smarty.foreach.gtmOrderVoucherIteration.last}], [{/if}][{/foreach}]',
|
||||
'paymentType': '[{$gtmBasket->getPaymentOnPaymentId()}]',
|
||||
'items':
|
||||
[
|
||||
[{foreach from=$gtmArticles item="gtmBasketItem" name="gtmArticles"}]
|
||||
[{assign var="gtmPurchaseItemPriceObject" value=$gtmBasketItem->getPrice()}]
|
||||
[{assign var="gtmPurchaseItem" value=$gtmBasketItem->getArticle()}]
|
||||
[{assign var="gtmPurchaseItemCategory" value=$gtmPurchaseItem->getCategory()}]
|
||||
|
||||
{
|
||||
'item_id': '[{$gtmBasketItem->getFieldData("oxartnum")}]',
|
||||
'item_name': '[{$gtmBasketItem->getFieldData("oxtitle")}]',
|
||||
'affiliation': '[{$gtmBasketItem->getFieldData("oxtitle")}]',
|
||||
'coupon': '[{foreach from=$gtmOrderVouchers item="gtmOrderVoucher" name="gtmOrderVoucherIteration"}][{$gtmOrderVoucher}][{if !$smarty.foreach.gtmOrderVoucherIteration.last}], [{/if}][{/foreach}]',
|
||||
'item_variant': '[{$gtmBasketItem->getFieldData("oxselvariant")}]',
|
||||
[{if $gtmPurchaseItemCategory}]
|
||||
'item_category': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(0, true)}]',
|
||||
'item_category_2': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(1, true)}]',
|
||||
'item_category_3': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(2, true)}]',
|
||||
'item_category_4': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(3, true)}]',
|
||||
'item_list_name': '[{$gtmPurchaseItemCategory->getSplitCategoryArray()}]',
|
||||
[{/if}]
|
||||
'price': [{$gtmPurchaseItemPriceObject->getPrice()}],
|
||||
'quantity': [{$gtmBasketItem->getFieldData("oxamount")}],
|
||||
'position': [{$smarty.foreach.gtmArticles.iteration}]
|
||||
}[{if !$smarty.foreach.gtmArticles.last}],[{/if}]
|
||||
[{/foreach}]
|
||||
]
|
||||
}[{if $oViewConf->isDebugModeOn()}],
|
||||
'debug_mode': 'true'
|
||||
[{/if}]
|
||||
})
|
||||
[{/strip}]
|
||||
[{/capture}]
|
||||
[{oxscript add=$smarty.capture.d3_ga4_purchase}]
|
||||
[{/block}]
|
@ -1,9 +1,7 @@
|
||||
[{$smarty.block.parent}]
|
||||
|
||||
[{block name="d3_ga4_remove_from_cart_block"}]
|
||||
[{if $hasBeenReloaded}]
|
||||
[{assign var="d3BasketPrice" value=$oxcmp_basket->getPrice()}]
|
||||
[{capture assign=d3_ga4_remove_from_cart}]
|
||||
[{capture name="d3_ga4_remove_from_cart"}]
|
||||
[{strip}]
|
||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||
dataLayer.push({
|
||||
@ -24,10 +22,10 @@
|
||||
'item_name': '[{$rmItem->getFieldData('oxtitle')}]',
|
||||
'item_variant': '[{$rmItem->getFieldData('oxvarselect')}]',
|
||||
[{if $gtmBasketItemCategory}]
|
||||
'item_category': '[{$gtmBasketItemCategory->getSplitCategoryArray(0)}]',
|
||||
'item_category_2': '[{$gtmBasketItemCategory->getSplitCategoryArray(1)}]',
|
||||
'item_category_3': '[{$gtmBasketItemCategory->getSplitCategoryArray(2)}]',
|
||||
'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3)}]',
|
||||
'item_category': '[{$gtmBasketItemCategory->getSplitCategoryArray(0, true)}]',
|
||||
'item_category_2': '[{$gtmBasketItemCategory->getSplitCategoryArray(1, true)}]',
|
||||
'item_category_3': '[{$gtmBasketItemCategory->getSplitCategoryArray(2, true)}]',
|
||||
'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3, true)}]',
|
||||
'item_list_name': '[{$gtmBasketItemCategory->getSplitCategoryArray()}]',
|
||||
[{/if}]
|
||||
'price': [{$d3oItemPrice->getPrice()}],
|
||||
@ -43,6 +41,6 @@
|
||||
});
|
||||
[{/strip}]
|
||||
[{/capture}]
|
||||
[{oxscript add=$d3_ga4_remove_from_cart}]
|
||||
[{oxscript add=$smarty.capture.d3_ga4_remove_from_cart}]
|
||||
[{/if}]
|
||||
[{/block}]
|
50
Application/views/event/view_cart.tpl
Normal file
50
Application/views/event/view_cart.tpl
Normal file
@ -0,0 +1,50 @@
|
||||
[{*$oxcmp_basket|get_class_methods|dumpvar*}]
|
||||
|
||||
[{assign var="d3BasketPrice" value=$oxcmp_basket->getPrice()}]
|
||||
[{assign var='gtmCartArticles' value=$oView->getBasketArticles()}]
|
||||
|
||||
[{block name="d3_ga4_view_cart_block"}]
|
||||
[{capture name="d3_ga4_view_cart"}]
|
||||
[{strip}]
|
||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||
dataLayer.push({
|
||||
'event': 'view_cart',
|
||||
'eventLabel':'Checkout Step 1',
|
||||
'ecommerce':
|
||||
{
|
||||
'actionField': "step: 1",
|
||||
'currency': "[{$currency->name}]",
|
||||
'value': [{$d3BasketPrice->getPrice()}],
|
||||
'coupon': '[{foreach from=$oxcmp_basket->getVouchers() item=sVoucher key=key name=Voucher}][{$sVoucher->sVoucherNr}][{if !$smarty.foreach.Voucher.last}], [{/if}][{/foreach}]',
|
||||
'items':
|
||||
[
|
||||
[{foreach from=$oxcmp_basket->getContents() item=basketitem name=gtmCartContents key=basketindex}]
|
||||
[{assign var="d3oItemPrice" value=$basketitem->getPrice()}]
|
||||
[{assign var="gtmBasketItem" value=$basketitem->getArticle()}]
|
||||
[{assign var="gtmBasketItemCategory" value=$gtmBasketItem->getCategory()}]
|
||||
{
|
||||
'item_id': '[{$gtmCartArticles[$basketindex]->getFieldData('oxartnum')}]',
|
||||
'item_name': '[{$gtmCartArticles[$basketindex]->getFieldData('oxtitle')}]',
|
||||
'item_variant': '[{$gtmCartArticles[$basketindex]->getFieldData('oxvarselect')}]',
|
||||
[{if $gtmBasketItemCategory}]
|
||||
'item_category': '[{$gtmBasketItemCategory->getSplitCategoryArray(0, true)}]',
|
||||
'item_category_2': '[{$gtmBasketItemCategory->getSplitCategoryArray(1, true)}]',
|
||||
'item_category_3': '[{$gtmBasketItemCategory->getSplitCategoryArray(2, true)}]',
|
||||
'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3, true)}]',
|
||||
'item_list_name': '[{$gtmBasketItemCategory->getSplitCategoryArray()}]',
|
||||
[{/if}]
|
||||
'price': [{$d3oItemPrice->getPrice()}],
|
||||
'coupon': '[{foreach from=$oxcmp_basket->getVouchers() item=sVoucher key=key name=Voucher}][{$sVoucher->sVoucherNr}][{if !$smarty.foreach.Voucher.last}], [{/if}][{/foreach}]',
|
||||
'quantity': [{$basketitem->getAmount()}],
|
||||
'position': [{$smarty.foreach.gtmCartContents.index}]
|
||||
}[{if !$smarty.foreach.gtmCartContents.last}],[{/if}]
|
||||
[{/foreach}]
|
||||
]
|
||||
}[{if $oViewConf->isDebugModeOn()}],
|
||||
'debug_mode': 'true'
|
||||
[{/if}]
|
||||
});
|
||||
[{/strip}]
|
||||
[{/capture}]
|
||||
[{oxscript add=$smarty.capture.d3_ga4_view_cart}]
|
||||
[{/block}]
|
41
Application/views/event/view_item.tpl
Normal file
41
Application/views/event/view_item.tpl
Normal file
@ -0,0 +1,41 @@
|
||||
[{assign var="gtmProduct" value=$oView->getProduct()}]
|
||||
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
|
||||
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
|
||||
|
||||
[{block name="d3_ga4_view_item_block"}]
|
||||
[{capture name="d3_ga4_view_item"}]
|
||||
[{strip}]
|
||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||
|
||||
dataLayer.push({
|
||||
'event': 'view_item',
|
||||
'eventLabel':'Product View',
|
||||
'ecommerce':
|
||||
{
|
||||
'currency': '[{$currency->name}]',
|
||||
'items':
|
||||
[
|
||||
{
|
||||
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
|
||||
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
|
||||
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
||||
'item_variant': '[{if $gtmProduct->getFieldData("oxvarselect")}][{$gtmProduct->getFieldData("oxvarselect")}][{/if}]',
|
||||
[{if $gtmCategory}]
|
||||
'item_category': '[{$gtmCategory->getSplitCategoryArray(0, true)}]',
|
||||
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1, true)}]',
|
||||
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2, true)}]',
|
||||
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3, true)}]',
|
||||
'item_list_name':'[{$gtmCategory->getSplitCategoryArray()}]',
|
||||
[{/if}]
|
||||
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
|
||||
'price': [{$d3PriceObject->getPrice()}]
|
||||
}
|
||||
]
|
||||
}[{if $oViewConf->isDebugModeOn()}],
|
||||
'debug_mode': 'true'
|
||||
[{/if}]
|
||||
});
|
||||
[{/strip}]
|
||||
[{/capture}]
|
||||
[{oxscript add=$smarty.capture.d3_ga4_view_item}]
|
||||
[{/block}]
|
@ -1,4 +1,3 @@
|
||||
[{$smarty.block.parent}]
|
||||
[{assign var="gtmProducts" value=$oView->getArticleList()}]
|
||||
[{assign var="gtmCategory" value=$oView->getActiveCategory()}]
|
||||
|
||||
@ -6,7 +5,7 @@
|
||||
|
||||
[{block name="d3_ga4_view_item_list_block"}]
|
||||
[{if $gtmProducts|@count}]
|
||||
[{capture assign=d3_ga4_view_item_list}]
|
||||
[{capture name="d3_ga4_view_item_list"}]
|
||||
[{strip}]
|
||||
dataLayer.push({ecommerce: null});
|
||||
dataLayer.push({
|
||||
@ -26,10 +25,10 @@
|
||||
'price': [{$d3PriceObject->getPrice()}],
|
||||
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
||||
[{if $gtmCategory}]
|
||||
'item_category': '[{$gtmCategory->getSplitCategoryArray(0)}]',
|
||||
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1)}]',
|
||||
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2)}]',
|
||||
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3)}]',
|
||||
'item_category': '[{$gtmCategory->getSplitCategoryArray(0, true)}]',
|
||||
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1, true)}]',
|
||||
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2, true)}]',
|
||||
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3, true)}]',
|
||||
[{/if}]
|
||||
'quantity': 1
|
||||
}[{if !$smarty.foreach.gtmProducts.last}],[{/if}]
|
||||
@ -41,6 +40,6 @@
|
||||
});
|
||||
[{/strip}]
|
||||
[{/capture}]
|
||||
[{oxscript add=$d3_ga4_view_item_list}]
|
||||
[{oxscript add=$smarty.capture.d3_ga4_view_item_list}]
|
||||
[{/if}]
|
||||
[{/block}]
|
@ -1,10 +1,8 @@
|
||||
[{$smarty.block.parent}]
|
||||
|
||||
[{assign var="gtmProducts" value=$oView->getArticleList()}]
|
||||
|
||||
[{block name="d3_ga4_view_search_result_block"}]
|
||||
[{if $gtmProducts}]
|
||||
[{capture assign=d3_ga4_view_search_result}]
|
||||
[{capture name="d3_ga4_view_search_result"}]
|
||||
[{strip}]
|
||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||
dataLayer.push({
|
||||
@ -23,10 +21,10 @@
|
||||
'price': [{$d3PriceObject->getPrice()}],
|
||||
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
||||
[{if $gtmCategory}]
|
||||
'item_category': '[{$gtmCategory->getSplitCategoryArray(0)}]',
|
||||
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1)}]',
|
||||
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2)}]',
|
||||
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3)}]',
|
||||
'item_category': '[{$gtmCategory->getSplitCategoryArray(0, true)}]',
|
||||
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1, true)}]',
|
||||
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2, true)}]',
|
||||
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3, true)}]',
|
||||
'item_list_name':'[{$gtmCategory->getSplitCategoryArray()}]',
|
||||
[{/if}]
|
||||
'quantity': 1
|
||||
@ -39,6 +37,8 @@
|
||||
});
|
||||
[{/strip}]
|
||||
[{/capture}]
|
||||
[{oxscript add=$d3_ga4_view_search_result}]
|
||||
[{oxscript add=$smarty.capture.d3_ga4_view_search_result}]
|
||||
[{/if}]
|
||||
[{/block}]
|
||||
[{/block}]
|
||||
|
||||
[{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]
|
@ -1,52 +0,0 @@
|
||||
[{$smarty.block.parent}]
|
||||
|
||||
[{* variable $gtmProduct is passed from parent tempalte *}]
|
||||
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
|
||||
[{assign var="gtmCurrency" value=$oView->getActCurrency()}]
|
||||
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
|
||||
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
|
||||
|
||||
[{block name="d3_ga4_add_to_cart_block"}]
|
||||
[{capture assign=d3_ga4_add_to_cart}]
|
||||
[{strip}]
|
||||
$("#toBasket").click(function(event) {
|
||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||
|
||||
[{*** Debug cases ***}]
|
||||
[{*event.preventDefault();*}]
|
||||
|
||||
let iArtQuantity = $("#amountToBasket").val();
|
||||
|
||||
dataLayer.push({
|
||||
'isAddToBasket': true,
|
||||
'event':'add_to_cart',
|
||||
'eventLabel': 'add_to_cart',
|
||||
'ecommerce': {
|
||||
'currency': "[{$currency->name}]",
|
||||
'value': iArtQuantity*[{$d3PriceObject->getPrice()}],
|
||||
'items': [
|
||||
{
|
||||
'item_id': '[{$gtmProduct->getFieldData('oxartnum')}]',
|
||||
'item_name': '[{$gtmProduct->getFieldData('oxtitle')}]',
|
||||
'price': [{$d3PriceObject->getPrice()}],
|
||||
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
||||
'item_variant': '[{if $gtmProduct->getFieldData('oxvarselect')}][{$gtmProduct->getFieldData('oxvarselect')}][{/if}]',
|
||||
[{if $gtmCategory}]
|
||||
'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()}]',
|
||||
[{/if}]
|
||||
'quantity': iArtQuantity
|
||||
}
|
||||
]
|
||||
}[{if $oViewConf->isDebugModeOn()}],
|
||||
'debug_mode': 'true'
|
||||
[{/if}]
|
||||
});
|
||||
});
|
||||
[{/strip}]
|
||||
[{/capture}]
|
||||
[{oxscript add=$d3_ga4_add_to_cart}]
|
||||
[{/block}]
|
18
Application/views/tpl/page/account/d3gtmnoticelist.tpl
Normal file
18
Application/views/tpl/page/account/d3gtmnoticelist.tpl
Normal file
@ -0,0 +1,18 @@
|
||||
[{capture append="oxidBlock_content"}]
|
||||
[{assign var="template_title" value="MY_WISH_LIST"|oxmultilangassign}]
|
||||
<h1 class="page-header">[{oxmultilang ident="MY_WISH_LIST"}]</h1>
|
||||
|
||||
[{if $oView->getNoticeProductList()}]
|
||||
[{include file="widget/product/list.tpl" type="line" listId="noticelistProductList" title="" products=$oView->getNoticeProductList() removeFunction="tonoticelist" owishid=$oxcmp_user->oxuser__oxid->value}]
|
||||
[{else}]
|
||||
<p class="alert alert-info">[{oxmultilang ident="WISH_LIST_EMPTY"}]</p>
|
||||
[{/if}]
|
||||
|
||||
[{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]
|
||||
|
||||
[{insert name="oxid_tracker" title=$template_title}]
|
||||
[{/capture}]
|
||||
[{capture append="oxidBlock_sidebar"}]
|
||||
[{include file="page/account/inc/account_menu.tpl" active_link="noticelist"}]
|
||||
[{/capture}]
|
||||
[{include file="layout/page.tpl" sidebar="Left"}]
|
@ -0,0 +1,32 @@
|
||||
[{capture append="oxidBlock_content"}]
|
||||
[{assign var="template_title" value="LISTMANIA"|oxmultilangassign}]
|
||||
[{assign var="_actvrecommlist" value=$oView->getActiveRecommList()}]
|
||||
|
||||
<h1 class="page-header">[{oxmultilang ident="LISTMANIA"}]</h1>
|
||||
|
||||
[{if $oView->isSavedList()}]
|
||||
[{assign var="_statusMessage" value="LISTMANIA_LIST_SAVED"|oxmultilangassign}]
|
||||
[{include file="message/success.tpl" statusMessage=$_statusMessage}]
|
||||
[{/if}]
|
||||
|
||||
[{block name="account_redommendationlist_content"}]
|
||||
|
||||
[{include file="form/recommendation_edit.tpl" actvrecommlist=$_actvrecommlist}]
|
||||
|
||||
<hr>
|
||||
|
||||
[{if !$oView->getActiveRecommList()}]
|
||||
[{assign var="blEdit" value=true}]
|
||||
[{include file="page/recommendations/inc/list.tpl"}]
|
||||
[{/if}]
|
||||
[{/block}]
|
||||
|
||||
[{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]
|
||||
|
||||
[{insert name="oxid_tracker" title=$template_title}]
|
||||
[{/capture}]
|
||||
[{capture append="oxidBlock_sidebar"}]
|
||||
[{include file="page/account/inc/account_menu.tpl" active_link="recommendationlist"}]
|
||||
[{/capture}]
|
||||
[{include file="layout/page.tpl" sidebar="Left"}]
|
||||
|
44
Application/views/tpl/page/account/d3gtmwishlist.tpl
Normal file
44
Application/views/tpl/page/account/d3gtmwishlist.tpl
Normal file
@ -0,0 +1,44 @@
|
||||
[{capture append="oxidBlock_content"}]
|
||||
[{assign var="template_title" value="MY_GIFT_REGISTRY"|oxmultilangassign}]
|
||||
[{if !$oView->getWishListUsers() && $oView->getWishListSearchParam()}]
|
||||
[{assign var="_statusMessage" value="MESSAGE_SORRY_NO_GIFT_REGISTRY"|oxmultilangassign}]
|
||||
[{include file="message/error.tpl" statusMessage=$_statusMessage}]
|
||||
[{/if}]
|
||||
[{assign var="editval" value=$oView->getEnteredData()}]
|
||||
[{if $oView->isWishListEmailSent()}]
|
||||
[{assign var="_statusMessage" value="GIFT_REGISTRY_SENT_SUCCESSFULLY"|oxmultilangassign:$editval->rec_email}]
|
||||
[{include file="message/notice.tpl" statusMessage=$_statusMessage}]
|
||||
[{/if}]
|
||||
|
||||
<h1 class="page-header">[{$oView->getTitle()}]</h1>
|
||||
|
||||
<div class="wishlist-search">
|
||||
[{include file="form/wishlist_search.tpl" searchClass="account_wishlist"}]
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="wishlist">
|
||||
[{if $oView->getWishList()}]
|
||||
[{include file="form/wishlist_publish.tpl"}]
|
||||
<hr>
|
||||
[{include file="form/wishlist_suggest.tpl"}]
|
||||
[{/if}]
|
||||
</div>
|
||||
|
||||
[{if $oView->getWishList()}]
|
||||
[{include file="widget/product/list.tpl" type="line" listId="wishlistProductList" title="" products=$oView->getWishProductList() removeFunction="towishlist" toBasketFunction="tobasket" owishid=$oxcmp_user->oxuser__oxid->value}]
|
||||
[{else}]
|
||||
<p class="alert alert-info">
|
||||
[{oxmultilang ident="GIFT_REGISTRY_EMPTY"}]
|
||||
</p>
|
||||
[{/if}]
|
||||
|
||||
[{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]
|
||||
|
||||
[{insert name="oxid_tracker" title=$template_title}]
|
||||
[{/capture}]
|
||||
[{capture append="oxidBlock_sidebar"}]
|
||||
[{include file="page/account/inc/account_menu.tpl" active_link="wishlist"}]
|
||||
[{/capture}]
|
||||
[{include file="layout/page.tpl" sidebar="Left"}]
|
12
CHANGELOG.md
12
CHANGELOG.md
@ -129,6 +129,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
## [2.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.1...2.0) - 2023-01-20
|
||||
### Added
|
||||
- using of ContainerFactory in ViewConfig
|
||||
## [1.15.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.14.0...1.15.0) - 2024-01-25
|
||||
### Fixed
|
||||
- missing Component-ArticleDetails extension, missing ManufacturerListController extension
|
||||
|
||||
## [1.14.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.13.0...1.14.0) - 2024-01-03
|
||||
### Added
|
||||
- add_to_cart Event to several new shop-pages (landing-page, Account, category article-list, start)
|
||||
- PHPStan code-cleanup
|
||||
### Changed
|
||||
- template structure
|
||||
- code cleanup
|
||||
|
||||
## [1.13.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.12.0...1.13.0) - 2023-09-13
|
||||
### Added
|
||||
- extended Docs
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Technische Doku
|
||||
## GA4 Events / Customizing
|
||||
Für alle implementierten GA4 Events existieren Templates unter `source/modules/d3/googleanalytics4/Application/views/ga4/`, dabei entspricht der Dateiname dem Eventnamen in GA4.
|
||||
Für alle implementierten GA4 Events existieren Templates unter `source/modules/d3/googleanalytics4/Application/views/event/`, dabei entspricht der Dateiname dem Eventnamen in GA4.
|
||||
Die Einbindung dieser Event-Templates erfolgt über TPL-Blöcke unter `source/modules/d3/googleanalytics4/Application/views/blocks/`.
|
||||
*Hinweis: nicht alle templates sind bereits gefüllt. Wünschen Sie die Implementierung eines unausgefüllten templates?
|
||||
Kommen Sie auf uns zu unter https://www.d3data.de/
|
||||
|
@ -20,9 +20,49 @@ namespace D3\GoogleAnalytics4\Modules\Core{
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Model{
|
||||
class Category_parent extends \OxidEsales\Eshop\Application\Model\Category {}
|
||||
class Basket_parent extends \OxidEsales\Eshop\Application\Model\Basket {}
|
||||
class Manufacturer_parent extends \OxidEsales\Eshop\Application\Model\Manufacturer {}
|
||||
}
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Controller{
|
||||
|
||||
use OxidEsales\Eshop\Application\Controller\AccountNoticeListController;
|
||||
use OxidEsales\Eshop\Application\Controller\AccountRecommlistController;
|
||||
use OxidEsales\Eshop\Application\Controller\AccountWishlistController;
|
||||
use OxidEsales\Eshop\Application\Controller\Admin\ManufacturerController;
|
||||
use OxidEsales\Eshop\Application\Controller\ArticleListController;
|
||||
use OxidEsales\Eshop\Application\Controller\SearchController;
|
||||
use OxidEsales\Eshop\Application\Controller\StartController;
|
||||
|
||||
class BasketController_parent extends \OxidEsales\Eshop\Application\Controller\BasketController {}
|
||||
class ThankYouController_parent extends \OxidEsales\Eshop\Application\Controller\ThankYouController {}
|
||||
|
||||
class ArticleListController_AddToCartHelpMethods_parent extends ArticleListController {}
|
||||
|
||||
class ArticleDetailsController_parent extends \OxidEsales\Eshop\Application\Controller\ArticleDetailsController {}
|
||||
|
||||
class d3GtmAccountNoticeListController_parent extends AccountNoticeListController {}
|
||||
|
||||
class d3GtmAccountRecommlistController_parent extends AccountRecommlistController {}
|
||||
|
||||
class d3GtmAccountWishlistController_parent extends AccountWishlistController {}
|
||||
|
||||
class d3GtmStartController_parent extends StartController {}
|
||||
|
||||
class d3GtmSearchController_parent extends SearchController {}
|
||||
|
||||
class d3GtmManufacturerListController_parent extends ManufacturerController {}
|
||||
}
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Component{
|
||||
|
||||
use OxidEsales\Eshop\Application\Component\BasketComponent;
|
||||
|
||||
class d3GtmBasketComponentExtension_parent extends BasketComponent {}
|
||||
}
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Component\Widget{
|
||||
|
||||
use OxidEsales\Eshop\Application\Component\Widget\ArticleDetails;
|
||||
|
||||
class d3GtmWidgetArticleDetails_parent extends ArticleDetails {}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Component\Widget;
|
||||
|
||||
|
||||
class d3GtmWidgetArticleDetails extends d3GtmWidgetArticleDetails_parent
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
$return = parent::render();
|
||||
|
||||
$this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket'));
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Component;
|
||||
|
||||
use OxidEsales\Eshop\Application\Model\Article;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
|
||||
class d3GtmBasketComponentExtension extends d3GtmBasketComponentExtension_parent
|
||||
{
|
||||
/**
|
||||
* @param $sProductId
|
||||
* @param $dAmount
|
||||
* @param $aSel
|
||||
* @param $aPersParam
|
||||
* @param $blOverride
|
||||
* @return mixed|string
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function toBasket($sProductId = null, $dAmount = null, $aSel = null, $aPersParam = null, $blOverride = false)
|
||||
{
|
||||
$return = parent::toBasket($sProductId, $dAmount, $aSel, $aPersParam, $blOverride);
|
||||
|
||||
Registry::getSession()->setVariable('d3GtmAddToBasketTrigger', true);
|
||||
|
||||
$iAmountArticlesAddedToCart = (int) Registry::getRequest()->getRequestEscapedParameter('am');
|
||||
|
||||
if ($iAmountArticlesAddedToCart){
|
||||
Registry::getSession()->setVariable('d3GtmAddToCartAmountArticles', $iAmountArticlesAddedToCart);
|
||||
}else{
|
||||
Registry::getSession()->setVariable('d3GtmAddToCartAmountArticles', 1);
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getD3GtmAddToCartAmountArticles() :int
|
||||
{
|
||||
$iAmount = Registry::getSession()->getVariable('d3GtmAddToCartAmountArticles');
|
||||
|
||||
Registry::getSession()->deleteVariable('d3GtmAddToCartAmountArticles');
|
||||
|
||||
return (int) $iAmount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getAddToBasketDecision() :bool
|
||||
{
|
||||
$decision = Registry::getSession()->getVariable('d3GtmAddToBasketTrigger');
|
||||
|
||||
Registry::getSession()->setVariable('d3GtmAddToBasketTrigger', false);
|
||||
|
||||
return (bool) $decision;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Article|null
|
||||
*/
|
||||
public function d3GtmRequestedArticleLoadedByAnid()
|
||||
{
|
||||
$sAnid = Registry::getRequest()->getRequestEscapedParameter('anid');
|
||||
|
||||
$oArticle = null;
|
||||
|
||||
if ($sAnid){
|
||||
/** @var Article $oArticle */
|
||||
$oArticle = oxNew(Article::class);
|
||||
$oArticle->load($sAnid);
|
||||
}
|
||||
|
||||
return $oArticle;
|
||||
}
|
||||
}
|
15
Modules/Application/Controller/ArticleDetailsController.php
Normal file
15
Modules/Application/Controller/ArticleDetailsController.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
|
||||
|
||||
class ArticleDetailsController extends ArticleDetailsController_parent
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
$return = parent::render();
|
||||
|
||||
$this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket'));
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
|
||||
|
||||
class ArticleListController_AddToCartHelpMethods extends ArticleListController_AddToCartHelpMethods_parent
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
$render = parent::render();
|
||||
|
||||
$this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket'));
|
||||
|
||||
return $render;
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@ use oxSystemComponentException;
|
||||
class BasketController extends BasketController_parent
|
||||
{
|
||||
/**
|
||||
* @throws oxSystemComponentException
|
||||
* @return string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
@ -33,22 +33,18 @@ class BasketController extends BasketController_parent
|
||||
$aProducts = Registry::getRequest()->getRequestEscapedParameter('aproducts');
|
||||
|
||||
// collecting specified item
|
||||
$sProductId = $sProductId ?? Registry::getRequest()->getRequestEscapedParameter('aid');
|
||||
$sProductId = Registry::getRequest()->getRequestEscapedParameter('aid');
|
||||
if ($sProductId) {
|
||||
// additionally fetching current product info
|
||||
$dAmount = $dAmount ?? Registry::getRequest()->getRequestEscapedParameter('am');
|
||||
$dAmount = Registry::getRequest()->getRequestEscapedParameter('am');
|
||||
|
||||
// select lists
|
||||
$aSel = $aSel ?? Registry::getRequest()->getRequestEscapedParameter('sel');
|
||||
$aSel = Registry::getRequest()->getRequestEscapedParameter('sel');
|
||||
|
||||
// persistent parameters
|
||||
if (empty($aPersParam)) {
|
||||
/** @var BasketComponent $oBasketComponent */
|
||||
$oBasketComponent = $this->getComponent('oxcmp_basket');
|
||||
|
||||
/** @var BasketComponent $oBasketComponent */
|
||||
$oBasketComponent = $this->getComponent('oxcmp_basket');
|
||||
|
||||
$aPersParam = $oBasketComponent->__call('getPersistedParameters', []);
|
||||
}
|
||||
$aPersParam = $oBasketComponent->__call('getPersistedParameters', []);
|
||||
|
||||
$sBasketItemId = Registry::getRequest()->getRequestEscapedParameter('bindex');
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
|
||||
|
||||
use OxidEsales\Eshop\Application\Model\Country;
|
||||
use OxidEsales\Eshop\Application\Model\Order;
|
||||
|
||||
class ThankYouController extends ThankYouController_parent
|
||||
{
|
||||
@ -11,7 +12,9 @@ class ThankYouController extends ThankYouController_parent
|
||||
*/
|
||||
public function d3GAGetUserCountry()
|
||||
{
|
||||
$sCountryId = $this->getOrder()->getFieldData('oxbillcountryid');
|
||||
/** @var Order $oOrder */
|
||||
$oOrder = $this->getOrder();
|
||||
$sCountryId = $oOrder->getFieldData('oxbillcountryid');
|
||||
|
||||
/** @var Country $oCountry */
|
||||
$oCountry = oxNew(Country::class);
|
||||
|
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
|
||||
|
||||
class d3GtmAccountNoticeListController extends d3GtmAccountNoticeListController_parent
|
||||
{
|
||||
protected $_sThisTemplate = 'page/account/d3gtmnoticelist.tpl';
|
||||
|
||||
public function render()
|
||||
{
|
||||
$return = parent::render();
|
||||
|
||||
$this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket'));
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
|
||||
|
||||
class d3GtmAccountRecommlistController extends d3GtmAccountRecommlistController_parent
|
||||
{
|
||||
protected $_sThisTemplate = 'page/account/d3gtmrecommendationlist.tpl';
|
||||
|
||||
public function render()
|
||||
{
|
||||
$return = parent::render();
|
||||
|
||||
$this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket'));
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
|
||||
|
||||
class d3GtmAccountWishlistController extends d3GtmAccountWishlistController_parent
|
||||
{
|
||||
protected $_sThisTemplate = 'page/account/d3gtmwishlist.tpl';
|
||||
|
||||
public function render()
|
||||
{
|
||||
$return = parent::render();
|
||||
|
||||
$this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket'));
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
|
||||
|
||||
|
||||
class d3GtmManufacturerListController extends d3GtmManufacturerListController_parent
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
$return = parent::render();
|
||||
|
||||
$this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket'));
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
23
Modules/Application/Controller/d3GtmSearchController.php
Normal file
23
Modules/Application/Controller/d3GtmSearchController.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
|
||||
|
||||
|
||||
class d3GtmSearchController extends d3GtmSearchController_parent
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$return = parent::render();
|
||||
|
||||
if (false === in_array('oxcmp_basket', $this->getComponents())){
|
||||
$this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket'));
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
19
Modules/Application/Controller/d3GtmStartController.php
Normal file
19
Modules/Application/Controller/d3GtmStartController.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
|
||||
|
||||
class d3GtmStartController extends d3GtmStartController_parent
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
$return = parent::render();
|
||||
|
||||
if (false === in_array('oxcmp_basket', $this->getComponents())){
|
||||
$this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket'));
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
@ -7,7 +7,7 @@ use OxidEsales\Eshop\Application\Model\Payment;
|
||||
class Basket extends Basket_parent
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
public function getPaymentOnPaymentId() :string
|
||||
{
|
||||
|
@ -8,9 +8,9 @@ class Category extends Category_parent
|
||||
* @param int $indexOfArray
|
||||
* @return string
|
||||
*/
|
||||
public function getSplitCategoryArray(int $indexOfArray = -1) :string
|
||||
public function getSplitCategoryArray(int $indexOfArray = -1, bool $bShallTakeStd = false) :string
|
||||
{
|
||||
if ($indexOfArray > -1){
|
||||
if ($bShallTakeStd){
|
||||
$splitCatArray =
|
||||
array_values(
|
||||
array_filter(
|
||||
@ -26,7 +26,7 @@ class Category extends Category_parent
|
||||
)
|
||||
);
|
||||
|
||||
if ($splitCatArray[$indexOfArray]){
|
||||
if (($indexOfArray >= 0) and (false === empty($splitCatArray[$indexOfArray]))){
|
||||
return $splitCatArray[$indexOfArray];
|
||||
}else{
|
||||
return "";
|
||||
|
@ -8,9 +8,9 @@ class Manufacturer extends Manufacturer_parent
|
||||
* @param int $indexOfArray
|
||||
* @return string
|
||||
*/
|
||||
public function getSplitCategoryArray(int $indexOfArray = -1) :string
|
||||
public function getSplitCategoryArray(int $indexOfArray = -1, bool $bShallTakeStd = false) :string
|
||||
{
|
||||
if ($indexOfArray > -1){
|
||||
if ($bShallTakeStd){
|
||||
$splitCatArray =
|
||||
array_values(
|
||||
array_filter(
|
||||
@ -26,7 +26,7 @@ class Manufacturer extends Manufacturer_parent
|
||||
)
|
||||
);
|
||||
|
||||
if ($splitCatArray[$indexOfArray]){
|
||||
if (($indexOfArray >= 0) and (false === empty($splitCatArray[$indexOfArray]))){
|
||||
return $splitCatArray[$indexOfArray];
|
||||
}else{
|
||||
return "";
|
||||
|
@ -15,6 +15,7 @@ namespace D3\GoogleAnalytics4\Modules\Core;
|
||||
use D3\GoogleAnalytics4\Application\Model\ManagerHandler;
|
||||
use D3\GoogleAnalytics4\Application\Model\ManagerTypes;
|
||||
use OxidEsales\Eshop\Application\Controller\FrontendController;
|
||||
use OxidEsales\Eshop\Application\Model\User;
|
||||
use OxidEsales\Eshop\Core\Config;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
||||
@ -180,7 +181,8 @@ class ViewConfig extends ViewConfig_parent
|
||||
|
||||
$oConfig = Registry::getConfig();
|
||||
$oView = $oConfig->getTopActiveView();
|
||||
/** @var FrontendController $oShop */
|
||||
|
||||
/** @var User|false|null $oUser */
|
||||
$oUser = $oConfig->getUser();
|
||||
|
||||
$cl = $this->getTopActiveClassName();
|
||||
@ -203,8 +205,8 @@ class ViewConfig extends ViewConfig_parent
|
||||
'title' => $oView->getTitle(),
|
||||
'cl' => $cl,
|
||||
],
|
||||
'userid' => ($oUser ? $oUser->getId() : false),
|
||||
'sessionid' => session_id() ?? false,
|
||||
'userid' => $oUser instanceof User ? $oUser->getId() : false,
|
||||
'sessionid' => session_id(),
|
||||
//'httpref' => $_SERVER["HTTP_REFERER"] ?? "unknown"
|
||||
];
|
||||
|
||||
|
@ -46,8 +46,8 @@
|
||||
"require": {
|
||||
"php": ">=7.1",
|
||||
"oxid-esales/oxideshop-ce": "^6.5",
|
||||
"google/apiclient":" ^2.0"
|
||||
},
|
||||
"google/apiclient":" ^2.0",
|
||||
"phpstan/phpstan": "^1.8" },
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"D3\\GoogleAnalytics4\\": "../../../source/modules/d3/googleanalytics4"
|
||||
|
82
metadata.php
82
metadata.php
@ -2,12 +2,28 @@
|
||||
|
||||
|
||||
use D3\GoogleAnalytics4\Modules\Application\Controller\BasketController;
|
||||
use D3\GoogleAnalytics4\Modules\Application\Controller\d3GtmAccountNoticeListController;
|
||||
use D3\GoogleAnalytics4\Modules\Application\Controller\d3GtmAccountRecommlistController;
|
||||
use D3\GoogleAnalytics4\Modules\Application\Controller\d3GtmAccountWishlistController;
|
||||
use D3\GoogleAnalytics4\Modules\Application\Controller\d3GtmManufacturerListController as d3GtmManufacturerListController;
|
||||
use D3\GoogleAnalytics4\Modules\Application\Controller\d3GtmSearchController;
|
||||
use D3\GoogleAnalytics4\Modules\Application\Controller\d3GtmStartController;
|
||||
use D3\GoogleAnalytics4\Modules\Application\Controller\ThankYouController;
|
||||
use D3\GoogleAnalytics4\Modules\Application\Model\Basket as Basket;
|
||||
use D3\GoogleAnalytics4\Modules\Application\Model\Category as Category;
|
||||
use D3\GoogleAnalytics4\Modules\Application\Model\Manufacturer as Manufacturer;
|
||||
use D3\GoogleAnalytics4\Modules\Core\ViewConfig;
|
||||
use OxidEsales\Eshop\Application\Component\BasketComponent as OEBasketComponent;
|
||||
use OxidEsales\Eshop\Application\Component\Widget\ArticleDetails as OEArticleDetails;
|
||||
use OxidEsales\Eshop\Application\Controller\AccountNoticeListController as OEAccountNoticeListController;
|
||||
use OxidEsales\Eshop\Application\Controller\AccountRecommlistController as OEAccountRecommlistController;
|
||||
use OxidEsales\Eshop\Application\Controller\AccountWishlistController as OEAccountWishlistController;
|
||||
use OxidEsales\Eshop\Application\Controller\ArticleDetailsController as OEArticleDetailsController;
|
||||
use OxidEsales\Eshop\Application\Controller\ArticleListController as OEArticleListController;
|
||||
use OxidEsales\Eshop\Application\Controller\BasketController as OEBasketController;
|
||||
use OxidEsales\Eshop\Application\Controller\ManufacturerListController as OEManufacturerListController;
|
||||
use OxidEsales\Eshop\Application\Controller\SearchController as OESearchController;
|
||||
use OxidEsales\Eshop\Application\Controller\StartController as OEStartController;
|
||||
use OxidEsales\Eshop\Application\Controller\ThankYouController as OEThankYouController;
|
||||
use OxidEsales\Eshop\Application\Model\Basket as OEBasket;
|
||||
use OxidEsales\Eshop\Application\Model\Category as OECategory;
|
||||
@ -34,14 +50,46 @@ $aModule = [
|
||||
'email' => 'support@shopmodule.com',
|
||||
'url' => 'https://www.oxidmodule.com/',
|
||||
'extend' => [
|
||||
OEViewConfig::class => ViewConfig::class,
|
||||
OECategory::class => Category::class,
|
||||
OEBasket::class => Basket::class,
|
||||
OEBasketController::class => BasketController::class,
|
||||
OEManufacturer::class => Manufacturer::class,
|
||||
OEThankYouController::class => ThankYouController::class
|
||||
// Core
|
||||
OEViewConfig::class => ViewConfig::class,
|
||||
|
||||
// Model
|
||||
OECategory::class => Category::class,
|
||||
OEBasket::class => Basket::class,
|
||||
OEManufacturer::class => Manufacturer::class,
|
||||
|
||||
// Controller
|
||||
OEBasketController::class => BasketController::class,
|
||||
OEThankYouController::class => ThankYouController::class,
|
||||
OEArticleListController::class => ArticleListController_AddToCartHelpMethods::class,
|
||||
OEArticleDetailsController::class => ArticleDetailsController::class,
|
||||
OEAccountNoticeListController::class => d3GtmAccountNoticeListController::class,
|
||||
OEAccountRecommlistController::class => d3GtmAccountRecommlistController::class,
|
||||
OEAccountWishlistController::class => d3GtmAccountWishlistController::class,
|
||||
OEStartController::class => d3GtmStartController::class,
|
||||
OESearchController::class => d3GtmSearchController::class,
|
||||
OEManufacturerListController::class => d3GtmManufacturerListController::class,
|
||||
|
||||
// Component
|
||||
OEArticleDetails::class => d3GtmWidgetArticleDetails::class,
|
||||
OEBasketComponent::class => d3GtmBasketComponentExtension::class,
|
||||
],
|
||||
'templates' => [
|
||||
// Event files that store the GA4 Event-Information
|
||||
'event/add_to_cart.tpl' => 'd3/googleanalytics4/Application/views/event/add_to_cart.tpl',
|
||||
'event/view_item.tpl' => 'd3/googleanalytics4/Application/views/event/view_item.tpl',
|
||||
'event/view_cart.tpl' => 'd3/googleanalytics4/Application/views/event/view_cart.tpl',
|
||||
'event/purchase.tpl' => 'd3/googleanalytics4/Application/views/event/purchase.tpl',
|
||||
'event/view_item_list.tpl' => 'd3/googleanalytics4/Application/views/event/view_item_list.tpl',
|
||||
'event/view_search_result.tpl' => 'd3/googleanalytics4/Application/views/event/view_search_result.tpl',
|
||||
'event/remove_from_cart.tpl' => 'd3/googleanalytics4/Application/views/event/remove_from_cart.tpl',
|
||||
|
||||
// complete overwritten file of OXID-Originals
|
||||
// the path of the template-name is the original path to the file in OXID-context from tpl/->
|
||||
'page/account/d3gtmnoticelist.tpl' => 'd3/googleanalytics4/Application/views/tpl/page/account/d3gtmnoticelist.tpl',
|
||||
'page/account/d3gtmrecommendationlist.tpl' => 'd3/googleanalytics4/Application/views/tpl/page/account/d3gtmrecommendationlist.tpl',
|
||||
'page/account/d3gtmwishlist.tpl' => 'd3/googleanalytics4/Application/views/tpl/page/account/d3gtmwishlist.tpl',
|
||||
],
|
||||
'templates' => [],
|
||||
'blocks' => [
|
||||
// tag manager js
|
||||
[
|
||||
@ -79,28 +127,40 @@ $aModule = [
|
||||
[
|
||||
'template' => 'page/list/list.tpl',
|
||||
'block' => 'page_list_productlist',
|
||||
'file' => '/Application/views/ga4/view_item_list.tpl',
|
||||
'file' => '/Application/views/blocks/view_item_list.tpl',
|
||||
'position' => 150
|
||||
],
|
||||
// view_search_result
|
||||
[
|
||||
'template' => 'page/search/search.tpl',
|
||||
'block' => 'search_results',
|
||||
'file' => '/Application/views/ga4/view_search_result.tpl',
|
||||
'file' => '/Application/views/blocks/view_search_result.tpl',
|
||||
'position' => 150
|
||||
],
|
||||
// add_to_cart
|
||||
[
|
||||
'template' => 'page/details/inc/productmain.tpl',
|
||||
'block' => 'details_productmain_tobasket',
|
||||
'file' => '/Application/views/ga4/add_to_cart.tpl',
|
||||
'file' => '/Application/views/blocks/details_productmain_tobasket.tpl',
|
||||
'position' => 150
|
||||
],
|
||||
[
|
||||
'template' => 'page/list/list.tpl',
|
||||
'block' => 'page_list_listbody',
|
||||
'file' => '/Application/views/blocks/page_list_listbody.tpl',
|
||||
'position' => 150
|
||||
],
|
||||
[
|
||||
'template' => 'page/shop/start.tpl',
|
||||
'block' => 'start_welcome_text',
|
||||
'file' => '/Application/views/blocks/start_welcome_text.tpl',
|
||||
'position' => 150
|
||||
],
|
||||
// remove_from_cart
|
||||
[
|
||||
'template' => 'page/checkout/basket.tpl',
|
||||
'block' => 'checkout_basket_main',
|
||||
'file' => '/Application/views/ga4/remove_from_cart.tpl',
|
||||
'file' => '/Application/views/blocks/remove_from_cart.tpl',
|
||||
'position' => 150
|
||||
]
|
||||
],
|
||||
|
18
phpstan.neon
18
phpstan.neon
@ -1,10 +1,16 @@
|
||||
parameters:
|
||||
scanFiles:
|
||||
- IntelliSenseHelper.php
|
||||
- ../../oxid-esales/oxideshop-ce/source/oxfunctions.php
|
||||
- ../../oxid-esales/oxideshop-ce/source/overridablefunctions.php
|
||||
level: 9
|
||||
phpVersion: 70100
|
||||
checkMissingIterableValueType: false
|
||||
- ../../../../Shops/CE/6.1.x/616_/vendor/oxid-esales/oxideshop-ce/source/bootstrap.php
|
||||
- ../../../../Shops/CE/6.1.x/616_/vendor/oxid-esales/oxideshop-ce/source/oxfunctions.php
|
||||
- ../../../../Shops/CE/6.1.x/616_/vendor/oxid-esales/oxideshop-ce/source/overridablefunctions.php
|
||||
scanDirectories:
|
||||
- ../../../../Shops/CE/6.1.x/616_/vendor/oxid-esales
|
||||
ignoreErrors:
|
||||
- '#Psr\\Container\\ContainerExceptionInterface is not subtype of Throwable#'
|
||||
- '#.*is not subtype of Throwable.*#'
|
||||
- '#\$sValue of method OxidEsales\\EshopCommunity\\Core\\Controller\\BaseController::addTplParam\(\) expects string,[ a-zA-Z\.]+#'
|
||||
paths:
|
||||
- ./
|
||||
level: 5
|
||||
phpVersion: 70200
|
||||
checkMissingIterableValueType: false
|
||||
|
Loading…
Reference in New Issue
Block a user