2012-02-15 14:15:28 +01:00
|
|
|
|
<?php
|
2013-04-22 11:40:11 +02:00
|
|
|
|
/**
|
|
|
|
|
* This Software is the property of Data Development and is protected
|
|
|
|
|
* by copyright law - it is NOT Freeware.
|
|
|
|
|
*
|
|
|
|
|
* Any unauthorized use of this software without a valid license
|
|
|
|
|
* is a violation of the license agreement and will be prosecuted by
|
|
|
|
|
* civil and criminal law.
|
|
|
|
|
*
|
|
|
|
|
* http://www.shopmodule.com
|
|
|
|
|
*
|
2015-12-21 14:28:34 +01:00
|
|
|
|
* @copyright <EFBFBD> D<EFBFBD> Data Development, Thomas Dartsch
|
|
|
|
|
* @author D<EFBFBD> Data Development - Daniel Seifert <ds@shopmodule.com>
|
2013-04-22 11:40:11 +02:00
|
|
|
|
* @link http://www.oxidmodule.com
|
|
|
|
|
*/
|
2015-12-21 14:28:34 +01:00
|
|
|
|
|
2020-04-17 09:29:09 +02:00
|
|
|
|
namespace D3\GeoIp\Application\Component;
|
|
|
|
|
|
|
|
|
|
use D3\GeoIp\Application\Model\d3geoip;
|
|
|
|
|
use D3\ModCfg\Application\Model\Configuration\d3_cfg_mod;
|
|
|
|
|
use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
|
|
|
|
|
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
|
|
|
|
|
use Doctrine\DBAL\DBALException;
|
|
|
|
|
use OxidEsales\Eshop\Core\Controller\BaseController;
|
|
|
|
|
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
|
|
|
|
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
|
|
|
|
use OxidEsales\Eshop\Core\Exception\StandardException;
|
|
|
|
|
use OxidEsales\Eshop\Core\Registry;
|
|
|
|
|
|
|
|
|
|
class d3cmp_geoip extends BaseController
|
2012-02-15 14:15:28 +01:00
|
|
|
|
{
|
2015-12-21 14:28:34 +01:00
|
|
|
|
/**
|
|
|
|
|
* Marking object as component
|
|
|
|
|
*
|
|
|
|
|
* @var bool
|
|
|
|
|
*/
|
|
|
|
|
protected $_blIsComponent = true;
|
|
|
|
|
|
2015-06-23 11:29:07 +02:00
|
|
|
|
private $_sModId = 'd3_geoip';
|
2013-04-22 11:25:27 +02:00
|
|
|
|
|
2020-04-17 09:29:09 +02:00
|
|
|
|
/**
|
|
|
|
|
* @throws d3ShopCompatibilityAdapterException
|
|
|
|
|
* @throws d3_cfg_mod_exception
|
|
|
|
|
* @throws DBALException
|
|
|
|
|
* @throws DatabaseConnectionException
|
|
|
|
|
* @throws DatabaseErrorException
|
|
|
|
|
* @throws StandardException
|
|
|
|
|
* @throws ConnectionException
|
|
|
|
|
* @throws SystemComponentException
|
|
|
|
|
*/
|
2012-02-15 14:15:28 +01:00
|
|
|
|
public function init()
|
|
|
|
|
{
|
2015-06-23 11:29:07 +02:00
|
|
|
|
if (d3_cfg_mod::get($this->_sModId)->isActive()) {
|
|
|
|
|
if (d3_cfg_mod::get($this->_sModId)->hasDebugMode()) {
|
2013-04-22 11:40:11 +02:00
|
|
|
|
/** @var $oGeoIp d3geoip */
|
2020-04-17 09:29:09 +02:00
|
|
|
|
$oGeoIp = oxNew(d3geoip::class);
|
2013-04-22 11:40:11 +02:00
|
|
|
|
echo $oGeoIp->getIP();
|
|
|
|
|
}
|
2013-04-22 11:25:27 +02:00
|
|
|
|
|
2013-04-22 11:40:11 +02:00
|
|
|
|
/** @var $oLocation d3geoip */
|
2020-04-17 09:29:09 +02:00
|
|
|
|
$oLocation = oxNew(d3geoip::class);
|
2013-04-22 11:40:11 +02:00
|
|
|
|
$oLocation->setCountryCurrency();
|
2017-03-03 08:55:15 +01:00
|
|
|
|
// moved to oxcmp_lang extension because here it's to late
|
|
|
|
|
// $oLocation->setCountryLanguage();
|
2016-02-25 17:47:32 +01:00
|
|
|
|
|
|
|
|
|
if (!isset($oBasket)) {
|
|
|
|
|
$oBasket = $this->getSession()->getBasket();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// call component again, if curr is registered before we changed it
|
|
|
|
|
// reason: own component can added after default components only
|
|
|
|
|
if ($oLocation->hasNotSetCurrency($oBasket->getBasketCurrency())) {
|
|
|
|
|
/** @var oxUBase $oActView */
|
2020-04-17 09:29:09 +02:00
|
|
|
|
$oActView = Registry::getConfig()->getActiveView();
|
2016-02-25 17:47:32 +01:00
|
|
|
|
$aComponents = $oActView->getComponents();
|
|
|
|
|
|
|
|
|
|
/** @var oxcmp_cur $oCurCmp */
|
|
|
|
|
$oCurCmp = $aComponents['oxcmp_cur'];
|
|
|
|
|
$oCurCmp->init();
|
|
|
|
|
}
|
|
|
|
|
// language isn't registered, we don't need an additional check
|
2015-06-23 11:29:07 +02:00
|
|
|
|
}
|
2012-02-15 14:15:28 +01:00
|
|
|
|
|
2015-07-21 21:12:55 +02:00
|
|
|
|
parent::init();
|
2012-02-15 14:15:28 +01:00
|
|
|
|
}
|
2015-12-24 12:51:39 +01:00
|
|
|
|
}
|