add test country settings

This commit is contained in:
Daniel Seifert 2013-04-22 09:25:27 +00:00
bovenliggende 77c40f050a
commit 816aa39a4a
5 gewijzigde bestanden met toevoegingen van 44 en 6 verwijderingen

Bestand weergeven

@ -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',

Bestand weergeven

@ -270,7 +270,7 @@ td.edittext {
</dl>
</div>
</div>
<div class="groupExp">
<div class="">
<a class="rc" onclick="_groupExp(this); return false;" href="#">
@ -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"}]
@ -297,7 +313,7 @@ td.edittext {
<dd>
<input type="text" maxlength="15" size="17" name="value[sCheckIp]" value="[{$edit->getValue('sCheckIp')}]">
[{ oxinputhelp ident="D3_GEOIP_SET_IP_CHECKIP_DESC" }]
[{if $edit->getValue('sCheckIp')}]
[{$oView->getIpCountry($edit->getValue('sCheckIp'))}]
[{/if}]

Bestand weergeven

@ -18,7 +18,7 @@ class d3_cfg_geoipset_main extends d3_cfg_mod_main
protected $_sModId = 'd3_geoip';
protected $_sThisTemplate = "d3_cfg_geoipset_main.tpl";
public function getIpCountry($sIP)
{
$oD3GeoIP = oxNew('d3geoip');
@ -31,7 +31,7 @@ class d3_cfg_geoipset_main extends d3_cfg_mod_main
return $sTitle;
}
public function getCountryList()
{
$oCountryList = oxNew('oxcountrylist');
@ -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;
}
}

Bestand weergeven

@ -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;

Bestand weergeven

@ -3,7 +3,7 @@
class d3_oxcmp_cur_geoip extends d3_oxcmp_cur_geoip_parent
{
private $_sModId = 'd3_geoip';
public function init()
{
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');
echo $oGeoIp->getIP();
}
$oLocation = oxNew('d3geoip');
//$oLocation->setUserCountry();
$oLocation->setCountryCurrency();