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_IP' => 'IP-Einstellungen',
'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_NOTSET' => 'IP nicht zugewiesen oder Land nicht aktiv',
'D3_GENERAL_GEOIP_SAVE' => 'Speichern',

View File

@ -290,6 +290,22 @@ td.edittext {
</dd>
<div class="spacer"></div>
</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>
<dt>
[{oxmultilang ident="D3_GEOIP_SET_IP_CHECKIP"}]

View File

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