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
|
|
|
|
|
|
|
|
|
class d3cmp_geoip extends oxView
|
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
|
|
|
|
|
2013-04-22 11:40:11 +02:00
|
|
|
|
/**
|
|
|
|
|
* @return null
|
|
|
|
|
*/
|
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 */
|
|
|
|
|
$oGeoIp = oxNew('d3geoip');
|
|
|
|
|
echo $oGeoIp->getIP();
|
|
|
|
|
}
|
2013-04-22 11:25:27 +02:00
|
|
|
|
|
2013-04-22 11:40:11 +02:00
|
|
|
|
/** @var $oLocation d3geoip */
|
|
|
|
|
$oLocation = oxNew('d3geoip');
|
|
|
|
|
$oLocation->setCountryCurrency();
|
2015-12-21 14:28:34 +01:00
|
|
|
|
$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 */
|
|
|
|
|
$oActView = oxRegistry::getConfig()->getActiveView();
|
|
|
|
|
$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
|
|
|
|
}
|