Merge remote-tracking branch 'remotes/origin/rel_1.x' into dev_2.x

This commit is contained in:
MaxBUhe 2024-01-22 11:13:05 +01:00
commit bcf38a6e11
42 changed files with 814 additions and 245 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.idea

View File

@ -31,11 +31,11 @@ $aLang = [
// for cookie manager settings
'SHOP_MODULE_GROUP_d3_gtm_settings_cookiemanager' => 'Cookie Manager Einstellungen',
'SHOP_MODULE_d3_gtm_settings_hasOwnCookieManager' => 'Cookie Manager nutzen?',
'HELP_SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER' => 'Mehr Informationen zu den genannten Coookie-Manager finden Sie auf den folgenden Home-Pages<br>
'HELP_SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER' => 'Mehr Informationen zu den genannten Coookie-Manager finden Sie auf den folgenden Home-Pages<br><br>
<a href="https://consentmanager.net/">Consentmanager</a><br>
<a href="https://usercentrics.com/">Usercentrics</a><br>
<a href="https://cookiefirst.com">Cookiefirst</a><br>
<hr>
Bei weiteren Fragen stehen wir gern zur Verfügung! Kontaktieren Sie uns einfach unter <a href="https://www.d3data.de/">https://www.d3data.de/</a>',
'SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER' => 'Nutzen Sie eine der folgenden Einbindungen?<br>
Dann wählen Sie bitte die zutreffende aus.',

View File

@ -0,0 +1,3 @@
[{$smarty.block.parent}]
[{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]

View File

@ -0,0 +1,3 @@
[{$smarty.block.parent}]
[{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]

View File

@ -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"}]

View File

@ -0,0 +1,3 @@
[{$smarty.block.parent}]
[{include file="event/remove_from_cart.tpl"}]

View File

@ -0,0 +1,3 @@
[{$smarty.block.parent}]
[{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]

View File

@ -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"}]

View File

@ -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"}]

View File

@ -0,0 +1,3 @@
[{$smarty.block.parent}]
[{include file="event/view_item_list.tpl"}]

View File

@ -0,0 +1,3 @@
[{$smarty.block.parent}]
[{include file="event/view_search_result.tpl"}]

View 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}]

View 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}]

View File

@ -0,0 +1,46 @@
[{block name="d3_ga4_remove_from_cart_block"}]
[{if $hasBeenReloaded}]
[{assign var="d3BasketPrice" value=$oxcmp_basket->getPrice()}]
[{capture name="d3_ga4_remove_from_cart"}]
[{strip}]
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
dataLayer.push({
'isRemoveFromCart': true,
'event': 'remove_from_cart',
'eventLabel':'remove_from_cart',
'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=$toRemoveArticles->getArray() name=gtmRemovedItems item=rmItem key=rmItemindex}]
[{assign var="d3oItemPrice" value=$rmItem->getPrice()}]
[{assign var="gtmBasketItemCategory" value=$rmItem->getCategory()}]
{
'item_id': '[{$rmItem->getFieldData('oxartnum')}]',
'item_name': '[{$rmItem->getFieldData('oxtitle')}]',
'item_variant': '[{$rmItem->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': '[{$rmItem->getFieldData('d3AmountThatGotRemoved')}]',
'position': [{$smarty.foreach.gtmRemovedItems.index}]
}[{if !$smarty.foreach.gtmRemovedItems.last}],[{/if}]
[{/foreach}]
]
}[{if $oViewConf->isDebugModeOn()}],
'debug_mode': 'true'
[{/if}]
});
[{/strip}]
[{/capture}]
[{oxscript add=$smarty.capture.d3_ga4_remove_from_cart}]
[{/if}]
[{/block}]

View 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}]

View 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}]

View File

@ -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}]

View File

@ -0,0 +1,44 @@
[{assign var="gtmProducts" value=$oView->getArticleList()}]
[{block name="d3_ga4_view_search_result_block"}]
[{if $gtmProducts}]
[{capture name="d3_ga4_view_search_result"}]
[{strip}]
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
dataLayer.push({
'event': 'view_search_result',
'eventLabel':'view_search_result[{if $oViewConf->isDebugModeOn()}]_test[{/if}]',
'ecommerce': {
'search_term': '[{$searchparamforhtml}]',
'items': [
[{foreach from=$gtmProducts name="gtmProducts" item="gtmProduct"}]
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
{
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
'price': [{$d3PriceObject->getPrice()}],
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/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': 1
}[{if !$smarty.foreach.gtmProducts.last}],[{/if}]
[{/foreach}]
]
}[{if $oViewConf->isDebugModeOn()}],
'debug_mode': 'true'
[{/if}]
});
[{/strip}]
[{/capture}]
[{oxscript add=$smarty.capture.d3_ga4_view_search_result}]
[{/if}]
[{/block}]
[{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]

View File

@ -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}]

View 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"}]

View File

@ -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"}]

View 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"}]

View File

@ -129,6 +129,38 @@ 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.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
### Changed
- control-param name
- control-param function
- adjusted check for set control-param
- consentmanager-script-adjustments
## [1.12.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.11.1...1.12.0) - 2023-09-07
### Added
- cookiebot functionality
## [1.11.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.11.0...1.11.1) - 2023-08-17
### Fixed
- metadata class entry
## [1.11.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.10.0...1.11.0) - 2023-08-16
### Added
- remove_from_cart
- auto debug_mode setter
- manufacturer extension for breadcrumb
### Changed
- general template cleanup
## [1.10.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.9.0...1.10.0) - 2023-06-27
### Added

View File

@ -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/
@ -19,7 +19,7 @@ Für den geregelten Ablauf sind folgende Blöcke nötig:
- Datei: page/search/search.tpl
- GA4 Event: view_search_results
- Artikelliste
- Blockname: page_list_productlist (muss hinzugefügt werden)
- Blockname: page_list_productlist
- Datei: page/list/list.tpl
- GA4 Event: view_item_list
- Detailseite
@ -30,6 +30,10 @@ Für den geregelten Ablauf sind folgende Blöcke nötig:
- Blockname: details_productmain_tobasket
- Datei: page/details/inc/productmain.tpl
- GA4 Event: add_to_cart
- aus dem WK entfernen
- Blockname: checkout_basket_main
- Datei: page/checkout/basket.tpl
- GA4 Event: remove_from_cart
- Warenkorb
- Blockname: checkout_basket_main
- Datei: page/checkout/basket.tpl

View File

@ -20,8 +20,39 @@ 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\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 {}
}
namespace D3\GoogleAnalytics4\Modules\Application\Component{
use OxidEsales\Eshop\Application\Component\BasketComponent;
class d3GtmBasketComponentExtension_parent extends BasketComponent {}
}

View File

@ -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;
}
}

View 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;
}
}

View File

@ -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;
}
}

View File

@ -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');
// persistent parameters
if (empty($aPersParam)) {
$aSel = Registry::getRequest()->getRequestEscapedParameter('sel');
/** @var BasketComponent $oBasketComponent */
$oBasketComponent = $this->getComponent('oxcmp_basket');
$aPersParam = $oBasketComponent->__call('getPersistedParameters', []);
}
$sBasketItemId = Registry::getRequest()->getRequestEscapedParameter('bindex');

View File

@ -0,0 +1,25 @@
<?php
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
use OxidEsales\Eshop\Application\Model\Country;
use OxidEsales\Eshop\Application\Model\Order;
class ThankYouController extends ThankYouController_parent
{
/**
* @return Country
*/
public function d3GAGetUserCountry()
{
/** @var Order $oOrder */
$oOrder = $this->getOrder();
$sCountryId = $oOrder->getFieldData('oxbillcountryid');
/** @var Country $oCountry */
$oCountry = oxNew(Country::class);
$oCountry->load($sCountryId);
return $oCountry;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View 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;
}
}

View 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;
}
}

View File

@ -7,7 +7,7 @@ use OxidEsales\Eshop\Application\Model\Payment;
class Basket extends Basket_parent
{
/**
* @return void
* @return string
*/
public function getPaymentOnPaymentId() :string
{

View File

@ -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 "";

View File

@ -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 "";

View File

@ -16,7 +16,7 @@ use D3\GoogleAnalytics4\Application\Model\ManagerHandler;
use D3\GoogleAnalytics4\Application\Model\ManagerTypes;
use OxidEsales\Eshop\Application\Controller\FrontendController;
use OxidEsales\Eshop\Core\Config;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Application\Model\User;use OxidEsales\Eshop\Core\Registry;
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
use OxidEsales\EshopCommunity\Internal\Framework\Module\Configuration\Bridge\ModuleSettingBridgeInterface;
use Psr\Container\ContainerExceptionInterface;
@ -174,7 +174,7 @@ 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();
@ -197,8 +197,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"
];

View File

@ -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.10" },
"autoload": {
"psr-4": {
"D3\\GoogleAnalytics4\\": "../../../source/modules/d3/googleanalytics4"

View File

@ -1,11 +1,29 @@
<?php
use D3\GoogleAnalytics4\Modules\Application\Component\d3GtmBasketComponentExtension;
use D3\GoogleAnalytics4\Modules\Application\Controller\ArticleDetailsController;
use D3\GoogleAnalytics4\Modules\Application\Controller\ArticleListController_AddToCartHelpMethods;
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\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\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\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;
use OxidEsales\Eshop\Application\Model\Manufacturer as OEManufacturer;
@ -33,11 +51,35 @@ $aModule = [
'extend' => [
OEViewConfig::class => ViewConfig::class,
OECategory::class => Category::class,
OEManufacturer::class => Manufacturer::class,
OEBasket::class => Basket::class,
OEBasketController::class => BasketController::class
OEBasketController::class => BasketController::class,
OEManufacturer::class => Manufacturer::class,
OEThankYouController::class => ThankYouController::class,
OEArticleListController::class => ArticleListController_AddToCartHelpMethods::class,
OEBasketComponent::class => d3GtmBasketComponentExtension::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
],
'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
[
@ -75,28 +117,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
]
],

View File

@ -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