2024-06-03 12:02:44 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace D3\GoogleAnalytics4\Setup;
|
|
|
|
|
|
|
|
|
|
|
|
use D3\GoogleAnalytics4\Application\Model\Constants;
|
|
|
|
use OxidEsales\Eshop\Core\Registry;
|
2024-06-24 16:08:36 +02:00
|
|
|
use OxidEsales\Eshop\Core\ViewConfig;
|
2024-06-03 12:02:44 +02:00
|
|
|
|
|
|
|
class Actions
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @param string $sVarType
|
|
|
|
* @param string $sSettingName
|
|
|
|
* @param string $sSettingValue
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function d3SaveDefaultSettings(string $sVarType, string $sSettingName, string $sSettingValue){
|
|
|
|
$oConfig = Registry::getConfig();
|
|
|
|
|
2024-07-30 15:55:52 +02:00
|
|
|
if ($this->d3GetModuleConfigParam($sSettingName) and (trim($this->d3GetModuleConfigParam($sSettingName)) !== trim($sSettingValue))){
|
2024-06-24 16:08:36 +02:00
|
|
|
$sSettingValue = trim($this->d3GetModuleConfigParam($sSettingName));
|
|
|
|
}
|
|
|
|
|
2024-06-03 12:02:44 +02:00
|
|
|
$oConfig->saveShopConfVar(
|
|
|
|
$sVarType,
|
|
|
|
Constants::OXID_MODULE_ID.$sSettingName,
|
|
|
|
$sSettingValue,
|
|
|
|
$oConfig->getShopId(),
|
|
|
|
Constants::OXID_MODULE_ID
|
|
|
|
);
|
|
|
|
}
|
2024-06-24 16:08:36 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $configParamName
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function d3GetModuleConfigParam(string $configParamName)
|
|
|
|
{
|
2024-07-30 15:55:52 +02:00
|
|
|
return Registry::getConfig()->getShopConfVar(Constants::OXID_MODULE_ID.$configParamName, null, Constants::OXID_MODULE_ID);
|
2024-06-24 16:08:36 +02:00
|
|
|
}
|
2024-06-03 12:02:44 +02:00
|
|
|
}
|