diff --git a/Application/views/event/add_to_cart.tpl b/Application/views/event/add_to_cart.tpl index 5ec242d..8d85631 100644 --- a/Application/views/event/add_to_cart.tpl +++ b/Application/views/event/add_to_cart.tpl @@ -41,10 +41,10 @@ '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)}]', - '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': iArtQuantity diff --git a/Application/views/event/purchase.tpl b/Application/views/event/purchase.tpl index 4ea1909..28f8444 100644 --- a/Application/views/event/purchase.tpl +++ b/Application/views/event/purchase.tpl @@ -34,10 +34,10 @@ '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_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()}], diff --git a/Application/views/event/remove_from_cart.tpl b/Application/views/event/remove_from_cart.tpl index 8de971f..ae3951b 100644 --- a/Application/views/event/remove_from_cart.tpl +++ b/Application/views/event/remove_from_cart.tpl @@ -22,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()}], diff --git a/Application/views/event/view_cart.tpl b/Application/views/event/view_cart.tpl index 879ab99..d87d478 100644 --- a/Application/views/event/view_cart.tpl +++ b/Application/views/event/view_cart.tpl @@ -27,10 +27,10 @@ '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_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()}], diff --git a/Application/views/event/view_item.tpl b/Application/views/event/view_item.tpl index 6f82d6b..f6349b9 100644 --- a/Application/views/event/view_item.tpl +++ b/Application/views/event/view_item.tpl @@ -21,10 +21,10 @@ '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_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()}] diff --git a/Application/views/event/view_item_list.tpl b/Application/views/event/view_item_list.tpl index 28a273e..2dbc0c9 100644 --- a/Application/views/event/view_item_list.tpl +++ b/Application/views/event/view_item_list.tpl @@ -25,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}] diff --git a/Application/views/event/view_search_result.tpl b/Application/views/event/view_search_result.tpl index 17fccec..aad6232 100644 --- a/Application/views/event/view_search_result.tpl +++ b/Application/views/event/view_search_result.tpl @@ -21,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 diff --git a/Modules/Application/Model/Category.php b/Modules/Application/Model/Category.php index 1f27087..713e4a5 100644 --- a/Modules/Application/Model/Category.php +++ b/Modules/Application/Model/Category.php @@ -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 ""; diff --git a/Modules/Application/Model/Manufacturer.php b/Modules/Application/Model/Manufacturer.php index 8ecae9a..1d98dda 100644 --- a/Modules/Application/Model/Manufacturer.php +++ b/Modules/Application/Model/Manufacturer.php @@ -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 ""; diff --git a/Modules/Core/ViewConfig.php b/Modules/Core/ViewConfig.php index 0bca35c..6e9fc16 100644 --- a/Modules/Core/ViewConfig.php +++ b/Modules/Core/ViewConfig.php @@ -185,8 +185,8 @@ class ViewConfig extends ViewConfig_parent 'title' => $oView->getTitle(), 'cl' => $cl, ], - 'userid' => ($oUser ? $oUser->getId() : false), - 'sessionid' => session_id() ?? false, + 'userid' => is_bool($oUser) ? false : $oUser->getId(), + 'sessionid' => session_id(), //'httpref' => $_SERVER["HTTP_REFERER"] ?? "unknown" ]; diff --git a/phpstan.neon b/phpstan.neon index 9c42940..3f7f8fa 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -10,6 +10,6 @@ parameters: - '#.*is not subtype of Throwable.*#' paths: - ./ - level: 3 + level: 4 phpVersion: 70200 checkMissingIterableValueType: false