From 7bc73893c38b95059cea08afad9628d3184f05cd Mon Sep 17 00:00:00 2001 From: MarkusGaertner Date: Thu, 8 Aug 2024 10:21:22 +0200 Subject: [PATCH] Prevent "OXID Logger.ERROR: D3\GoogleAnalytics4\Modules\Application\Controller\d3GtmStartController is not an instance of OxidEsales\Eshop\Application\Component\Widget\WidgetController" --- .../Component/Widget/d3GtmStartWidget.php | 10 ++++ Modules/Core/WidgetControl.php | 59 +++++++++++++++++++ metadata.php | 1 + 3 files changed, 70 insertions(+) create mode 100644 Application/Component/Widget/d3GtmStartWidget.php create mode 100644 Modules/Core/WidgetControl.php diff --git a/Application/Component/Widget/d3GtmStartWidget.php b/Application/Component/Widget/d3GtmStartWidget.php new file mode 100644 index 0000000..9403e84 --- /dev/null +++ b/Application/Component/Widget/d3GtmStartWidget.php @@ -0,0 +1,10 @@ + '2pistlaubiq58qtg3moudei0la', + 'lang' => '0', + 'actcontrol' => 'details', + 'anid' => '064471', + 'cl' => 'oxwarticledetails', + 'cnid' => '159dd0f2fb2bd6e24ace53a0f1913797', + 'listtype' => 'list', + 'nocookie' => '1', + 'oxwparent' => 'details', + 'sid' => '2pistlaubiq58qtg3moudei0la', + 'stoken' => 'A22D0F9E', + 'varselid' => + array ( + 0 => 'b842982bf522aa839bd88221f562fce8', + ), + ) + */ + + $aParameter = $_GET; + if( is_null($aParameter['actcontrol']) + && is_null($aParameter['actcontrol']) + && is_null($aParameter['actcontrol']) + ) + { + return 'D3\GoogleAnalytics4\Application\Component\Widget\d3GtmStartWidget'; + } + + return $this->getStartControllerKey(); + } + + protected function getStartControllerKey() + { + $controllerKey = Registry::getConfig()->getRequestControllerId(); + + // Use default route in case no controller id is given + if (!$controllerKey) { + $session = \OxidEsales\Eshop\Core\Registry::getSession(); + if ($this->isAdmin()) { + $controllerKey = $session->getVariable("auth") ? 'admin_start' : 'login'; + } else { + $controllerKey = $this->getFrontendStartControllerKey(); + } + $session->setVariable('cl', $controllerKey); + } + + return $controllerKey; + } +} \ No newline at end of file diff --git a/metadata.php b/metadata.php index 9addf64..4c311a9 100755 --- a/metadata.php +++ b/metadata.php @@ -60,6 +60,7 @@ $aModule = [ 'extend' => [ // Core OEViewConfig::class => ViewConfig::class, + \OxidEsales\Eshop\Core\WidgetControl::class => \D3\GoogleAnalytics4\Modules\Core\WidgetControl::class, // Model OECategory::class => Category::class,