add test country settings

This commit is contained in:
Daniel Seifert 2013-04-22 09:25:27 +00:00
parent 77c40f050a
commit 816aa39a4a
5 changed files with 44 additions and 6 deletions

View File

@ -39,6 +39,8 @@ $aLang = array(
'D3_GEOIP_SET_OPTIONS_NOCOUNTRY' => 'Shop verwendet die Einstellung dieses Landes, wenn IP nicht zuzuordnen ist', 'D3_GEOIP_SET_OPTIONS_NOCOUNTRY' => 'Shop verwendet die Einstellung dieses Landes, wenn IP nicht zuzuordnen ist',
'D3_GEOIP_SET_IP' => 'IP-Einstellungen', 'D3_GEOIP_SET_IP' => 'IP-Einstellungen',
'D3_GEOIP_SET_IP_TESTIP' => 'statt Kunden-IP immer diese IP-Adresse verwenden', 'D3_GEOIP_SET_IP_TESTIP' => 'statt Kunden-IP immer diese IP-Adresse verwenden',
'D3_GEOIP_SET_IP_TESTCOUNTRY' => 'statt Kunden-IP immer eine IP-Adresse dieses Landes verwenden',
'D3_GEOIP_SET_IP_TESTCOUNTRY_INACTIVE' => '(inaktiv)',
'D3_GEOIP_SET_IP_CHECKIP' => 'diese IP-Adresse prüfen', 'D3_GEOIP_SET_IP_CHECKIP' => 'diese IP-Adresse prüfen',
'D3_GEOIP_SET_IP_CHECKIP_NOTSET' => 'IP nicht zugewiesen oder Land nicht aktiv', 'D3_GEOIP_SET_IP_CHECKIP_NOTSET' => 'IP nicht zugewiesen oder Land nicht aktiv',
'D3_GENERAL_GEOIP_SAVE' => 'Speichern', 'D3_GENERAL_GEOIP_SAVE' => 'Speichern',

View File

@ -270,7 +270,7 @@ td.edittext {
</dl> </dl>
</div> </div>
</div> </div>
<div class="groupExp"> <div class="groupExp">
<div class=""> <div class="">
<a class="rc" onclick="_groupExp(this); return false;" href="#"> <a class="rc" onclick="_groupExp(this); return false;" href="#">
@ -290,6 +290,22 @@ td.edittext {
</dd> </dd>
<div class="spacer"></div> <div class="spacer"></div>
</dl> </dl>
<dl>
<dt>
[{oxmultilang ident="D3_GEOIP_SET_IP_TESTCOUNTRY"}]
<input type="hidden" name="value[blUseTestCountry]" value="0">
<input class="edittext ext_edittext" type="checkbox" name="value[blUseTestCountry]" value='1' [{if $edit->getValue('blUseTestCountry') == 1}]checked[{/if}]>
</dt>
<dd>
<select name="value[sTestCountryIp]" size="1" class="edittext ext_edittext">
[{foreach from=$oView->getIPCountryList() item="oCountry"}]
<option value="[{$oCountry->getFieldData('IP')}]" [{if $edit->getValue('sTestCountryIp') == $oCountry->getFieldData('IP')}] selected[{/if}]>[{$oCountry->getFieldData('oxtitle')}][{if !$oCountry->getFieldData('oxactive')}] [{oxmultilang ident="D3_GEOIP_SET_IP_TESTCOUNTRY_INACTIVE"}][{/if}]</option>
[{/foreach}]
</select>
[{ oxinputhelp ident="D3_GEOIP_SET_IP_TESTCOUNTRY_DESC" }]
</dd>
<div class="spacer"></div>
</dl>
<dl> <dl>
<dt> <dt>
[{oxmultilang ident="D3_GEOIP_SET_IP_CHECKIP"}] [{oxmultilang ident="D3_GEOIP_SET_IP_CHECKIP"}]
@ -297,7 +313,7 @@ td.edittext {
<dd> <dd>
<input type="text" maxlength="15" size="17" name="value[sCheckIp]" value="[{$edit->getValue('sCheckIp')}]"> <input type="text" maxlength="15" size="17" name="value[sCheckIp]" value="[{$edit->getValue('sCheckIp')}]">
[{ oxinputhelp ident="D3_GEOIP_SET_IP_CHECKIP_DESC" }] [{ oxinputhelp ident="D3_GEOIP_SET_IP_CHECKIP_DESC" }]
[{if $edit->getValue('sCheckIp')}] [{if $edit->getValue('sCheckIp')}]
[{$oView->getIpCountry($edit->getValue('sCheckIp'))}] [{$oView->getIpCountry($edit->getValue('sCheckIp'))}]
[{/if}] [{/if}]

View File

@ -18,7 +18,7 @@ class d3_cfg_geoipset_main extends d3_cfg_mod_main
protected $_sModId = 'd3_geoip'; protected $_sModId = 'd3_geoip';
protected $_sThisTemplate = "d3_cfg_geoipset_main.tpl"; protected $_sThisTemplate = "d3_cfg_geoipset_main.tpl";
public function getIpCountry($sIP) public function getIpCountry($sIP)
{ {
$oD3GeoIP = oxNew('d3geoip'); $oD3GeoIP = oxNew('d3geoip');
@ -31,7 +31,7 @@ class d3_cfg_geoipset_main extends d3_cfg_mod_main
return $sTitle; return $sTitle;
} }
public function getCountryList() public function getCountryList()
{ {
$oCountryList = oxNew('oxcountrylist'); $oCountryList = oxNew('oxcountrylist');
@ -46,4 +46,21 @@ class d3_cfg_geoipset_main extends d3_cfg_mod_main
return $oCountryList; return $oCountryList;
} }
public function getIPCountryList()
{
$oGeoIp = oxNew('d3geoip');
$oCountryList = oxNew('oxcountrylist');
if ($oCountryList->getBaseObject()->isMultilang())
{
$oCountryList->getBaseObject()->setLanguage(oxLang::getInstance()->getTplLanguage());
}
$oListObject = $oCountryList->getBaseObject();
$sFieldList = $oListObject->getSelectFields();
$sQ = "select (SELECT d3startip FROM ".$oGeoIp->getViewName()." WHERE D3ISO = " .$oListObject->getViewName(). ".oxisoalpha2 LIMIT 1) as IP, $sFieldList from " . $oListObject->getViewName();
$oCountryList->selectString($sQ);
return $oCountryList;
}
} }

View File

@ -80,6 +80,8 @@ class d3GeoIP extends oxI18n
{ {
if ($this->_getModConfig()->getValue('blUseTestIp') && $this->_getModConfig()->getValue('sTestIp')) if ($this->_getModConfig()->getValue('blUseTestIp') && $this->_getModConfig()->getValue('sTestIp'))
return $this->_getModConfig()->getValue('sTestIp'); return $this->_getModConfig()->getValue('sTestIp');
elseif ($this->_getModConfig()->getValue('blUseTestCountry') && $this->_getModConfig()->getValue('sTestCountryIp'))
return $this->_getModConfig()->getValue('sTestCountryIp');
else else
return $_SERVER['REMOTE_ADDR']; return $_SERVER['REMOTE_ADDR'];
} }
@ -119,6 +121,7 @@ class d3GeoIP extends oxI18n
{ {
$oCountry = oxNew('oxcountry'); $oCountry = oxNew('oxcountry');
$sSelect = "SELECT oxid FROM ".$oCountry->getViewName()." WHERE OXISOALPHA2 = '".$sISOAlpha."' AND OXACTIVE = '1'"; $sSelect = "SELECT oxid FROM ".$oCountry->getViewName()." WHERE OXISOALPHA2 = '".$sISOAlpha."' AND OXACTIVE = '1'";
$oCountry->load(oxDb::getDb()->getOne($sSelect)); $oCountry->load(oxDb::getDb()->getOne($sSelect));
return $oCountry; return $oCountry;

View File

@ -3,7 +3,7 @@
class d3_oxcmp_cur_geoip extends d3_oxcmp_cur_geoip_parent class d3_oxcmp_cur_geoip extends d3_oxcmp_cur_geoip_parent
{ {
private $_sModId = 'd3_geoip'; private $_sModId = 'd3_geoip';
public function init() public function init()
{ {
if (d3_cfg_mod::get($this->_sModId)->getValue('blDebugmodeGlobal')) if (d3_cfg_mod::get($this->_sModId)->getValue('blDebugmodeGlobal'))
@ -11,7 +11,7 @@ class d3_oxcmp_cur_geoip extends d3_oxcmp_cur_geoip_parent
$oGeoIp = oxNew('d3geoip'); $oGeoIp = oxNew('d3geoip');
echo $oGeoIp->getIP(); echo $oGeoIp->getIP();
} }
$oLocation = oxNew('d3geoip'); $oLocation = oxNew('d3geoip');
//$oLocation->setUserCountry(); //$oLocation->setUserCountry();
$oLocation->setCountryCurrency(); $oLocation->setCountryCurrency();