add fallback mode, if IP is unknown
This commit is contained in:
parent
7d05c18cd0
commit
cb34aa735e
@ -36,6 +36,7 @@ $aLang = array(
|
|||||||
'D3_GEOIP_SET_OPTIONS_CHANGECURR' => 'Währung wechseln, wenn eingestellt',
|
'D3_GEOIP_SET_OPTIONS_CHANGECURR' => 'Währung wechseln, wenn eingestellt',
|
||||||
'D3_GEOIP_SET_OPTIONS_CHANGELANG' => 'Sprache wechseln, wenn eingestellt',
|
'D3_GEOIP_SET_OPTIONS_CHANGELANG' => 'Sprache wechseln, wenn eingestellt',
|
||||||
'D3_GEOIP_SET_OPTIONS_CHANGEURL' => 'URL wechseln, wenn eingestellt',
|
'D3_GEOIP_SET_OPTIONS_CHANGEURL' => 'URL wechseln, wenn eingestellt',
|
||||||
|
'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_CHECKIP' => 'diese IP-Adresse prüfen',
|
'D3_GEOIP_SET_IP_CHECKIP' => 'diese IP-Adresse prüfen',
|
||||||
|
@ -252,6 +252,22 @@ td.edittext {
|
|||||||
</dd>
|
</dd>
|
||||||
<div class="spacer"></div>
|
<div class="spacer"></div>
|
||||||
</dl>
|
</dl>
|
||||||
|
<dl>
|
||||||
|
<dt>
|
||||||
|
[{oxmultilang ident="D3_GEOIP_SET_OPTIONS_NOCOUNTRY"}]
|
||||||
|
<input type="hidden" name="value[blUseFallback]" value="0">
|
||||||
|
<input class="edittext ext_edittext" type="checkbox" name="value[blUseFallback]" value='1' [{if $edit->getValue('blUseFallback') == 1}]checked[{/if}]>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
<select size="5" name="value[sFallbackCountryId]">
|
||||||
|
[{foreach from=$oView->getCountryList() item="oCountry"}]
|
||||||
|
<option value="[{$oCountry->getId()}]" [{if $edit->getValue('sFallbackCountryId') == $oCountry->getId()}] selected[{/if}]>[{$oCountry->oxcountry__oxtitle->value}]</option>
|
||||||
|
[{/foreach}]
|
||||||
|
</select>
|
||||||
|
[{ oxinputhelp ident="D3_GEOIP_SET_OPTIONS_NOCOUNTRY_DESC" }]
|
||||||
|
</dd>
|
||||||
|
<div class="spacer"></div>
|
||||||
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@ $aLang = array(
|
|||||||
'D3_GEOIP_SET_OPTIONS_CHANGECURR' => 'Währung wechseln, wenn eingestellt',
|
'D3_GEOIP_SET_OPTIONS_CHANGECURR' => 'Währung wechseln, wenn eingestellt',
|
||||||
'D3_GEOIP_SET_OPTIONS_CHANGELANG' => 'Sprache wechseln, wenn eingestellt',
|
'D3_GEOIP_SET_OPTIONS_CHANGELANG' => 'Sprache wechseln, wenn eingestellt',
|
||||||
'D3_GEOIP_SET_OPTIONS_CHANGEURL' => 'URL wechseln, wenn eingestellt',
|
'D3_GEOIP_SET_OPTIONS_CHANGEURL' => 'URL wechseln, wenn eingestellt',
|
||||||
|
'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_CHECKIP' => 'diese IP-Adresse prüfen',
|
'D3_GEOIP_SET_IP_CHECKIP' => 'diese IP-Adresse prüfen',
|
||||||
|
@ -252,6 +252,22 @@ td.edittext {
|
|||||||
</dd>
|
</dd>
|
||||||
<div class="spacer"></div>
|
<div class="spacer"></div>
|
||||||
</dl>
|
</dl>
|
||||||
|
<dl>
|
||||||
|
<dt>
|
||||||
|
[{oxmultilang ident="D3_GEOIP_SET_OPTIONS_NOCOUNTRY"}]
|
||||||
|
<input type="hidden" name="value[blUseFallback]" value="0">
|
||||||
|
<input class="edittext ext_edittext" type="checkbox" name="value[blUseFallback]" value='1' [{if $edit->getValue('blUseFallback') == 1}]checked[{/if}]>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
<select size="5" name="value[sFallbackCountryId]">
|
||||||
|
[{foreach from=$oView->getCountryList() item="oCountry"}]
|
||||||
|
<option value="[{$oCountry->getId()}]" [{if $edit->getValue('sFallbackCountryId') == $oCountry->getId()}] selected[{/if}]>[{$oCountry->oxcountry__oxtitle->value}]</option>
|
||||||
|
[{/foreach}]
|
||||||
|
</select>
|
||||||
|
[{ oxinputhelp ident="D3_GEOIP_SET_OPTIONS_NOCOUNTRY_DESC" }]
|
||||||
|
</dd>
|
||||||
|
<div class="spacer"></div>
|
||||||
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -31,4 +31,19 @@ class d3_cfg_geoipset_main extends d3_cfg_mod_main
|
|||||||
|
|
||||||
return $sTitle;
|
return $sTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getCountryList()
|
||||||
|
{
|
||||||
|
$oCountryList = oxNew('oxcountrylist');
|
||||||
|
if ($oCountryList->getBaseObject()->isMultilang())
|
||||||
|
{
|
||||||
|
$oCountryList->getBaseObject()->setLanguage(oxLang::getInstance()->getTplLanguage());
|
||||||
|
}
|
||||||
|
$oListObject = $oCountryList->getBaseObject();
|
||||||
|
$sFieldList = $oListObject->getSelectFields();
|
||||||
|
$sQ = "select $sFieldList from " . $oListObject->getViewName();
|
||||||
|
$oCountryList->selectString($sQ);
|
||||||
|
|
||||||
|
return $oCountryList;
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,5 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
// @copyright © D³ Data Development
|
||||||
|
//
|
||||||
|
// 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 key
|
||||||
|
// is a violation of the license agreement and will be prosecuted by
|
||||||
|
// civil and criminal law.
|
||||||
|
//
|
||||||
|
// http://www.shopmodule.com
|
||||||
|
|
||||||
|
// AUTOR Daniel Seifert <ds@shopmodule.com>
|
||||||
|
|
||||||
class d3GeoIP extends oxI18n
|
class d3GeoIP extends oxI18n
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -35,7 +48,7 @@ class d3GeoIP extends oxI18n
|
|||||||
if (!$sISOAlpha)
|
if (!$sISOAlpha)
|
||||||
{
|
{
|
||||||
$this->_getLog()->setLog('error', __CLASS__, __FUNCTION__, __LINE__, 'get ISO by IP failed', $sIP);
|
$this->_getLog()->setLog('error', __CLASS__, __FUNCTION__, __LINE__, 'get ISO by IP failed', $sIP);
|
||||||
$this->oCountry = oxNew('oxcountry');
|
$this->oCountry = $this->getCountryFallBackObject();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -70,13 +83,25 @@ class d3GeoIP extends oxI18n
|
|||||||
|
|
||||||
public function getCountryObject($sISOAlpha)
|
public function getCountryObject($sISOAlpha)
|
||||||
{
|
{
|
||||||
$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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getCountryFallBackObject()
|
||||||
|
{
|
||||||
|
$oCountry = oxNew('oxcountry');
|
||||||
|
|
||||||
|
if ($this->_getConfig()->getValue('blUseFallback') && $this->_getConfig()->getValue('sFallbackCountryId'))
|
||||||
|
{
|
||||||
|
$oCountry->Load($this->_getConfig()->getValue('sFallbackCountryId'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $oCountry;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
public function setUserCountry()
|
public function setUserCountry()
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
INSERT INTO `d3_cfg_mod` (`OXID`, `OXSHOPID`, `OXMODID`, `OXNAME`, `OXACTIVE`, `OXSERIAL`, `OXINSTALLDATE`, `OXVERSION`, `OXSHOPVERSION`, `OXISMODULELOG`, `OXREQUIREMENTS`, `OXVALUE`, `OXVALUE_1`, `OXVALUE_2`, `OXREVISION`, `OXNEWREVISION`) VALUES
|
INSERT INTO `d3_cfg_mod` (`OXID`, `OXSHOPID`, `OXMODID`, `OXNAME`, `OXACTIVE`, `OXSERIAL`, `OXINSTALLDATE`, `OXVERSION`, `OXSHOPVERSION`, `OXISMODULELOG`, `OXREQUIREMENTS`, `OXVALUE`, `OXVALUE_1`, `OXVALUE_2`, `OXREVISION`, `OXNEWREVISION`) VALUES
|
||||||
(MD5(RAND()), 1, 'd3_geoip', 'GeoIP', 1, '', NOW(), '2.0.0', 'EE4', 0, '', '', '', '', 14, 14);
|
(MD5(RAND()), 1, 'd3_geoip', 'GeoIP', 1, '', NOW(), '2.1.0', 'EE4', 0, '', '', '', '', 18, 18);
|
||||||
INSERT INTO `d3_cfg_mod` (`OXID`, `OXSHOPID`, `OXMODID`, `OXNAME`, `OXACTIVE`, `OXSERIAL`, `OXINSTALLDATE`, `OXVERSION`, `OXSHOPVERSION`, `OXISMODULELOG`, `OXREQUIREMENTS`, `OXVALUE`, `OXVALUE_1`, `OXVALUE_2`, `OXREVISION`, `OXNEWREVISION`) VALUES
|
INSERT INTO `d3_cfg_mod` (`OXID`, `OXSHOPID`, `OXMODID`, `OXNAME`, `OXACTIVE`, `OXSERIAL`, `OXINSTALLDATE`, `OXVERSION`, `OXSHOPVERSION`, `OXISMODULELOG`, `OXREQUIREMENTS`, `OXVALUE`, `OXVALUE_1`, `OXVALUE_2`, `OXREVISION`, `OXNEWREVISION`) VALUES
|
||||||
(MD5(RAND()), 2, 'd3_geoip', 'GeoIP', 1, '', NOW(), '2.0.0', 'EE4', 0, '', '', '', '', 14, 14);
|
(MD5(RAND()), 2, 'd3_geoip', 'GeoIP', 1, '', NOW(), '2.1.0', 'EE4', 0, '', '', '', '', 18, 18);
|
||||||
INSERT INTO `d3_cfg_mod` (`OXID`, `OXSHOPID`, `OXMODID`, `OXNAME`, `OXACTIVE`, `OXSERIAL`, `OXINSTALLDATE`, `OXVERSION`, `OXSHOPVERSION`, `OXISMODULELOG`, `OXREQUIREMENTS`, `OXVALUE`, `OXVALUE_1`, `OXVALUE_2`, `OXREVISION`, `OXNEWREVISION`) VALUES
|
INSERT INTO `d3_cfg_mod` (`OXID`, `OXSHOPID`, `OXMODID`, `OXNAME`, `OXACTIVE`, `OXSERIAL`, `OXINSTALLDATE`, `OXVERSION`, `OXSHOPVERSION`, `OXISMODULELOG`, `OXREQUIREMENTS`, `OXVALUE`, `OXVALUE_1`, `OXVALUE_2`, `OXREVISION`, `OXNEWREVISION`) VALUES
|
||||||
(MD5(RAND()), 3, 'd3_geoip', 'GeoIP', 1, '', NOW(), '2.0.0', 'EE4', 0, '', '', '', '', 14, 14);
|
(MD5(RAND()), 3, 'd3_geoip', 'GeoIP', 1, '', NOW(), '2.1.0', 'EE4', 0, '', '', '', '', 18, 18);
|
||||||
|
|
||||||
ALTER TABLE `oxcountry` ADD `D3GEOIPSHOP` VARCHAR( 10 ) NOT NULL DEFAULT '-1',
|
ALTER TABLE `oxcountry` ADD `D3GEOIPSHOP` VARCHAR( 10 ) NOT NULL DEFAULT '-1',
|
||||||
ADD `D3GEOIPLANG` TINYINT( 2 ) NOT NULL DEFAULT '-1',
|
ADD `D3GEOIPLANG` TINYINT( 2 ) NOT NULL DEFAULT '-1',
|
||||||
|
@ -10,3 +10,6 @@ INSERT INTO `d3_cfg_mod` (`OXID`, `OXSHOPID`, `OXMODID`, `OXNAME`, `OXACTIVE`, `
|
|||||||
INSERT INTO `d3_cfg_mod` (`OXID`, `OXSHOPID`, `OXMODID`, `OXNAME`, `OXACTIVE`, `OXSERIAL`, `OXINSTALLDATE`, `OXVERSION`, `OXSHOPVERSION`, `OXISMODULELOG`, `OXREQUIREMENTS`, `OXVALUE`, `OXVALUE_1`, `OXVALUE_2`, `OXREVISION`, `OXNEWREVISION`) VALUES
|
INSERT INTO `d3_cfg_mod` (`OXID`, `OXSHOPID`, `OXMODID`, `OXNAME`, `OXACTIVE`, `OXSERIAL`, `OXINSTALLDATE`, `OXVERSION`, `OXSHOPVERSION`, `OXISMODULELOG`, `OXREQUIREMENTS`, `OXVALUE`, `OXVALUE_1`, `OXVALUE_2`, `OXREVISION`, `OXNEWREVISION`) VALUES
|
||||||
(MD5(RAND()), 3, 'd3_geoip', 'GeoIP', 1, '', NOW(), '2.0.0', 'EE4', 0, '', '', '', '', 14, 14);
|
(MD5(RAND()), 3, 'd3_geoip', 'GeoIP', 1, '', NOW(), '2.0.0', 'EE4', 0, '', '', '', '', 14, 14);
|
||||||
ALTER TABLE `oxcountry` ADD `D3GEOIPURL` VARCHAR( 255 ) NOT NULL;
|
ALTER TABLE `oxcountry` ADD `D3GEOIPURL` VARCHAR( 255 ) NOT NULL;
|
||||||
|
|
||||||
|
# ==== 2.0.0 PE4 => 2.1.0 PE4 ====
|
||||||
|
UPDATE `d3_cfg_mod` SET `OXVERSION` = '2.1.0', `OXREVISION` = '18', `OXNEWREVISION` = '18' WHERE OXMODID = 'd3_geoip';
|
Binary file not shown.
@ -1,5 +1,5 @@
|
|||||||
INSERT INTO `d3_cfg_mod` (`OXID`, `OXSHOPID`, `OXMODID`, `OXNAME`, `OXACTIVE`, `OXSERIAL`, `OXINSTALLDATE`, `OXVERSION`, `OXSHOPVERSION`, `OXISMODULELOG`, `OXREQUIREMENTS`, `OXVALUE`, `OXVALUE_1`, `OXVALUE_2`, `OXREVISION`, `OXNEWREVISION`) VALUES
|
INSERT INTO `d3_cfg_mod` (`OXID`, `OXSHOPID`, `OXMODID`, `OXNAME`, `OXACTIVE`, `OXSERIAL`, `OXINSTALLDATE`, `OXVERSION`, `OXSHOPVERSION`, `OXISMODULELOG`, `OXREQUIREMENTS`, `OXVALUE`, `OXVALUE_1`, `OXVALUE_2`, `OXREVISION`, `OXNEWREVISION`) VALUES
|
||||||
(MD5(RAND()), 'oxbaseshop', 'd3_geoip', 'GeoIP', 1, '', NOW(), '2.0.0', 'PE4', 0, '', '', '', '', 14, 14);
|
(MD5(RAND()), 'oxbaseshop', 'd3_geoip', 'GeoIP', 1, '', NOW(), '2.1.0', 'PE4', 0, '', '', '', '', 18, 18);
|
||||||
|
|
||||||
ALTER TABLE `oxcountry` ADD `D3GEOIPSHOP` VARCHAR( 10 ) NOT NULL DEFAULT '-1',
|
ALTER TABLE `oxcountry` ADD `D3GEOIPSHOP` VARCHAR( 10 ) NOT NULL DEFAULT '-1',
|
||||||
ADD `D3GEOIPLANG` TINYINT( 2 ) NOT NULL DEFAULT '-1',
|
ADD `D3GEOIPLANG` TINYINT( 2 ) NOT NULL DEFAULT '-1',
|
||||||
|
@ -6,3 +6,6 @@ CHANGE `D3ENDIPNUM` `D3ENDIPNUM` INT( 10 ) UNSIGNED NOT NULL
|
|||||||
INSERT INTO `d3_cfg_mod` (`OXID`, `OXSHOPID`, `OXMODID`, `OXNAME`, `OXACTIVE`, `OXSERIAL`, `OXINSTALLDATE`, `OXVERSION`, `OXSHOPVERSION`, `OXISMODULELOG`, `OXREQUIREMENTS`, `OXVALUE`, `OXVALUE_1`, `OXVALUE_2`, `OXREVISION`, `OXNEWREVISION`) VALUES
|
INSERT INTO `d3_cfg_mod` (`OXID`, `OXSHOPID`, `OXMODID`, `OXNAME`, `OXACTIVE`, `OXSERIAL`, `OXINSTALLDATE`, `OXVERSION`, `OXSHOPVERSION`, `OXISMODULELOG`, `OXREQUIREMENTS`, `OXVALUE`, `OXVALUE_1`, `OXVALUE_2`, `OXREVISION`, `OXNEWREVISION`) VALUES
|
||||||
(MD5(RAND()), 'oxbaseshop', 'd3_geoip', 'GeoIP', 1, '', NOW(), '2.0.0', 'PE4', 0, '', '', '', '', 14, 14);
|
(MD5(RAND()), 'oxbaseshop', 'd3_geoip', 'GeoIP', 1, '', NOW(), '2.0.0', 'PE4', 0, '', '', '', '', 14, 14);
|
||||||
ALTER TABLE `oxcountry` ADD `D3GEOIPURL` VARCHAR( 255 ) NOT NULL;
|
ALTER TABLE `oxcountry` ADD `D3GEOIPURL` VARCHAR( 255 ) NOT NULL;
|
||||||
|
|
||||||
|
# ==== 2.0.0 PE4 => 2.1.0 PE4 ====
|
||||||
|
UPDATE `d3_cfg_mod` SET `OXVERSION` = '2.1.0', `OXREVISION` = '18', `OXNEWREVISION` = '18' WHERE OXMODID = 'd3_geoip';
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user