[Fixed] overwriting existing settings

accidentally the existing settings were overwritten
This commit is contained in:
MaxBUhe 2024-06-24 16:08:36 +02:00
parent 592ea4284c
commit cc2e9a5fc6

View File

@ -7,6 +7,7 @@ namespace D3\GoogleAnalytics4\Setup;
use D3\GoogleAnalytics4\Application\Model\Constants; use D3\GoogleAnalytics4\Application\Model\Constants;
use OxidEsales\Eshop\Core\Registry; use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\ViewConfig;
class Actions class Actions
{ {
@ -19,12 +20,23 @@ class Actions
public function d3SaveDefaultSettings(string $sVarType, string $sSettingName, string $sSettingValue){ public function d3SaveDefaultSettings(string $sVarType, string $sSettingName, string $sSettingValue){
$oConfig = Registry::getConfig(); $oConfig = Registry::getConfig();
$oConfig->saveShopConfVar( if (false === ($this->d3GetModuleConfigParam($sSettingName) === $sSettingValue)){
$sVarType, $oConfig->saveShopConfVar(
Constants::OXID_MODULE_ID.$sSettingName, $sVarType,
$sSettingValue, Constants::OXID_MODULE_ID.$sSettingName,
$oConfig->getShopId(), $sSettingValue,
Constants::OXID_MODULE_ID $oConfig->getShopId(),
); Constants::OXID_MODULE_ID
);
}
}
/**
* @param string $configParamName
* @return mixed
*/
public function d3GetModuleConfigParam(string $configParamName)
{
return Registry::get(ViewConfig::class)->d3GetModuleConfigParam($configParamName);
} }
} }