[Fixed] over-engineered Getter-methods
- the methods would semi-automatic search and set/ save params - I removed those and set it back to its base functionality: -- saving happens ONLY at the save() function if triggered by the user in the admin-frontend -- only one Getter who checks for a value in the DB ? give the value : no value given yet
This commit is contained in:
@ -21,7 +21,7 @@ class GA4AdminUserInterface_main extends \OxidEsales\Eshop\Application\Controlle
|
|||||||
$this->addTplParam('d3ViewObject', $this);
|
$this->addTplParam('d3ViewObject', $this);
|
||||||
$this->addTplParam('d3ViewConfObject', Registry::get(ViewConfig::class));
|
$this->addTplParam('d3ViewConfObject', Registry::get(ViewConfig::class));
|
||||||
$this->addTplParam('d3ManagerTypeArray', oxNew(ManagerTypes::class)->getManagerList());
|
$this->addTplParam('d3ManagerTypeArray', oxNew(ManagerTypes::class)->getManagerList());
|
||||||
$this->addTplParam('d3CurrentCMP', oxNew(ManagerHandler::class)->getCurrManager());
|
$this->addTplParam('d3CurrentCMP', oxNew(ManagerHandler::class)->getActManager());
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
@ -7,41 +7,11 @@ use OxidEsales\Eshop\Core\ViewConfig;
|
|||||||
|
|
||||||
class ManagerHandler
|
class ManagerHandler
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Gets current chosen Manager
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getCurrManager(): string
|
|
||||||
{
|
|
||||||
/** @var ManagerTypes $oManagerTypes */
|
|
||||||
$oManagerTypes = oxNew(ManagerTypes::class);
|
|
||||||
|
|
||||||
/** @var ViewConfig|\D3\GoogleAnalytics4\Modules\Core\ViewConfig $oViewConfig */
|
|
||||||
$oViewConfig = oxNew(ViewConfig::class);
|
|
||||||
|
|
||||||
$aManagerList = $oManagerTypes->getManagerList();
|
|
||||||
|
|
||||||
if ($this->getModuleSettingExplicitManagerSelectValue()) {
|
|
||||||
return $this->getExplicitManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($aManagerList as $shopModuleId => $publicCMPName) {
|
|
||||||
if ($oViewConfig->d3IsModuleActive($shopModuleId)) {
|
|
||||||
$this->d3SaveShopConfVar($shopModuleId);
|
|
||||||
return $shopModuleId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sParam
|
* @param string $sParam
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function d3SaveShopConfVar(string $sParam)
|
public function d3SaveShopConfVar(string $sParam){
|
||||||
{
|
|
||||||
Registry::getConfig()->saveShopConfVar(
|
Registry::getConfig()->saveShopConfVar(
|
||||||
'select',
|
'select',
|
||||||
Constants::OXID_MODULE_ID."_HAS_STD_MANAGER",
|
Constants::OXID_MODULE_ID."_HAS_STD_MANAGER",
|
||||||
@ -54,26 +24,8 @@ class ManagerHandler
|
|||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getModuleSettingExplicitManagerSelectValue(): string
|
public function getActManager() :string
|
||||||
{
|
{
|
||||||
return Registry::get(ViewConfig::class)->d3GetModuleConfigParam('_HAS_STD_MANAGER')?:"";
|
return Registry::get(ViewConfig::class)->d3GetModuleConfigParam('_HAS_STD_MANAGER')?:"";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getExplicitManager(): string
|
|
||||||
{
|
|
||||||
$sPotentialManagerName = $this->getModuleSettingExplicitManagerSelectValue();
|
|
||||||
|
|
||||||
/** @var ManagerTypes $oManagerTypes */
|
|
||||||
$oManagerTypes = oxNew(ManagerTypes::class);
|
|
||||||
$sCMPName = $oManagerTypes->isManagerInList($sPotentialManagerName)
|
|
||||||
? $sPotentialManagerName
|
|
||||||
: "NONE";
|
|
||||||
|
|
||||||
$this->d3SaveShopConfVar($sCMPName);
|
|
||||||
|
|
||||||
return $sCMPName;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -54,7 +54,7 @@ class ViewConfig extends ViewConfig_parent
|
|||||||
if ($this->sCookieManagerType === null) {
|
if ($this->sCookieManagerType === null) {
|
||||||
/** @var ManagerHandler $oManagerHandler */
|
/** @var ManagerHandler $oManagerHandler */
|
||||||
$oManagerHandler = oxNew(ManagerHandler::class);
|
$oManagerHandler = oxNew(ManagerHandler::class);
|
||||||
$this->sCookieManagerType = $oManagerHandler->getCurrManager();
|
$this->sCookieManagerType = $oManagerHandler->getActManager();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user