diff --git a/src/Application/Model/d3geoip.php b/src/Application/Model/d3geoip.php index 465c179..ad49a9b 100644 --- a/src/Application/Model/d3geoip.php +++ b/src/Application/Model/d3geoip.php @@ -242,11 +242,15 @@ class d3geoip extends BaseModel { startProfile(__METHOD__); + $this->_getModConfig()->d3getLog()->info(__CLASS__, __FUNCTION__, __LINE__, 'start shop or url switch'); $this->performURLSwitch(); $this->performShopSwitch(); + $this->_getModConfig()->d3getLog()->info(__CLASS__, __FUNCTION__, __LINE__, 'end shop or url switch'); if (!$this->_getModConfig()->isActive() - || false == $this->_getModConfig()->getValue('blChangeLang')) { + || false == $this->_getModConfig()->getValue('blChangeLang') + ) { + $this->_getModConfig()->d3getLog()->info(__CLASS__, __FUNCTION__, __LINE__, 'language change option or module is disabled'); stopProfile(__METHOD__); return; } @@ -259,16 +263,16 @@ class d3geoip extends BaseModel && Registry::getSession()->getVariable('d3isSetLang') === null && $oCountry->getId() && $oCountry->getFieldData('d3geoiplang') > -1 ) { - $this->_getLog()->log( - d3log::INFO, + $language = (int) $oCountry->getFieldData('d3geoiplang'); + $this->_getModConfig()->info( __CLASS__, __FUNCTION__, __LINE__, 'set language', - $this->getIP().' => '.$oCountry->getFieldData('d3geoiplang') + $this->getIP().' => '.$language ); - Registry::getLang()->setTplLanguage((int) $oCountry->getFieldData('d3geoiplang')); - Registry::getLang()->setBaseLanguage((int) $oCountry->getFieldData('d3geoiplang')); + Registry::getLang()->setTplLanguage($language); + Registry::getLang()->setBaseLanguage($language); Registry::getSession()->setVariable('d3isSetLang', true); } @@ -354,6 +358,7 @@ class d3geoip extends BaseModel public function performShopSwitch() { if (!$this->_getModConfig()->isActive() || !$this->_getModConfig()->getValue('blChangeShop')) { + $this->_getModConfig()->d3getLog()->info(__CLASS__, __FUNCTION__, __LINE__, 'shop change option or module is disabled'); return; } @@ -362,6 +367,8 @@ class d3geoip extends BaseModel $oCountry = $this->getUserLocationCountryObject(); $iNewShop = $oCountry->getFieldData('d3geoipshop'); + $this->_getModConfig()->d3getLog()->info(__CLASS__, __FUNCTION__, __LINE__, 'check allowed shop change'); + if (Registry::getRequest()->getRequestEscapedParameter('d3redirect') != 1 && false == $this->isAdmin() && Registry::getUtils()->isSearchEngine() === false @@ -373,6 +380,8 @@ class d3geoip extends BaseModel || strtolower(Registry::getConfig()->getActiveView()->getClassKey()) == 'mallstart' ) ) { + $this->_getModConfig()->d3getLog()->info(__CLASS__, __FUNCTION__, __LINE__, 'prepare shop change to '.$iNewShop); + $oNewConf = new Config(); $oNewConf->setShopId($iNewShop); $oNewConf->init(); @@ -410,6 +419,8 @@ class d3geoip extends BaseModel $this->getIP().' => '.$sUrl ); + $this->_getModConfig()->d3getLog()->info(__CLASS__, __FUNCTION__, __LINE__, 'change to shop url', $sUrl); + header("Location: ".$sUrl); exit(); } diff --git a/src/Modules/Application/Component/d3_oxcmp_lang_geoip.php b/src/Modules/Application/Component/d3_oxcmp_lang_geoip.php index 1984c22..3e7eb5b 100644 --- a/src/Modules/Application/Component/d3_oxcmp_lang_geoip.php +++ b/src/Modules/Application/Component/d3_oxcmp_lang_geoip.php @@ -43,7 +43,9 @@ class d3_oxcmp_lang_geoip extends d3_oxcmp_lang_geoip_parent if (d3_cfg_mod::get($this->_sModId)->isActive()) { /** @var $oLocation d3geoip */ $oLocation = oxNew(d3geoip::class); + d3_cfg_mod::get($this->_sModId)->d3getLog()->info(__CLASS__, __FUNCTION__, __LINE__, 'start perform language switch'); $oLocation->setCountryLanguage(); + d3_cfg_mod::get($this->_sModId)->d3getLog()->info(__CLASS__, __FUNCTION__, __LINE__, 'end perform language switch'); } parent::init();