Version Notes
Initial release.
Download this release
Release Info
| Developer | Liudas Stanevicius |
| Extension | visitor_country_ip_redirect |
| Version | 0.0.3 |
| Comparing to | |
| See all releases | |
Version 0.0.3
- app/code/local/Creation/Afipredirect/Adminhtml/Model/System/Config/Source/Countrylookupproviders.php +38 -0
- app/code/local/Creation/Afipredirect/Block/Ipredirect.php +63 -0
- app/code/local/Creation/Afipredirect/Helper/Data.php +316 -0
- app/code/local/Creation/Afipredirect/etc/adminhtml.xml +22 -0
- app/code/local/Creation/Afipredirect/etc/config.xml +49 -0
- app/code/local/Creation/Afipredirect/etc/system.xml +160 -0
- app/design/frontend/default/default/layout/afipredirect.xml +8 -0
- app/design/frontend/default/default/template/afipredirect/ipredirect.phtml +55 -0
- app/etc/modules/Creation_Afipredirect.xml +9 -0
- package.xml +32 -0
app/code/local/Creation/Afipredirect/Adminhtml/Model/System/Config/Source/Countrylookupproviders.php
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* @category Creation
|
| 4 |
+
* @package Creation_Afipredirect
|
| 5 |
+
* @author Liudas Stanevicius <liudas@creation.lt>
|
| 6 |
+
* @copyright Elsoft, UAB (www.creation.lt) <info@creation.lt>
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
class Creation_Afipredirect_Adminhtml_Model_System_Config_Source_Countrylookupproviders extends Mage_Core_Model_Config_Data
|
| 10 |
+
{
|
| 11 |
+
|
| 12 |
+
/**
|
| 13 |
+
* Options getter
|
| 14 |
+
*
|
| 15 |
+
* @return array
|
| 16 |
+
*/
|
| 17 |
+
public function toOptionArray()
|
| 18 |
+
{
|
| 19 |
+
return array(
|
| 20 |
+
array('value' => 'geoplugin', 'label'=>Mage::helper('adminhtml')->__('geoplugin.net')),
|
| 21 |
+
array('value' => 'hostip', 'label'=>Mage::helper('adminhtml')->__('hostip.info')),
|
| 22 |
+
array('value' => 'iptolatlng', 'label'=>Mage::helper('adminhtml')->__('iptolatlng.com')),
|
| 23 |
+
);
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
public function save()
|
| 27 |
+
{
|
| 28 |
+
$service_provider = $this->getValue();
|
| 29 |
+
|
| 30 |
+
if($service_provider != Mage::getStoreConfig( 'afipredirect/settings/country_lookup_service' ))
|
| 31 |
+
{
|
| 32 |
+
Mage::getSingleton('core/session')->addNotice ('You have changed the Country lookup service provider. Have in mind, that different providers could return different results.');
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
return parent::save();
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
}
|
app/code/local/Creation/Afipredirect/Block/Ipredirect.php
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* @category Creation
|
| 4 |
+
* @package Creation_Afipredirect
|
| 5 |
+
* @author Liudas Stanevicius <liudas@creation.lt>
|
| 6 |
+
* @copyright Elsoft, UAB (www.creation.lt) <info@creation.lt>
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
class Creation_Afipredirect_Block_Ipredirect extends Mage_Core_Block_Template
|
| 10 |
+
{
|
| 11 |
+
protected function _construct()
|
| 12 |
+
{
|
| 13 |
+
parent::_construct();
|
| 14 |
+
$this->_perform_redirect();
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
public function _perform_redirect()
|
| 18 |
+
{
|
| 19 |
+
$helper = $this->helper('afipredirect');
|
| 20 |
+
|
| 21 |
+
if($helper->isEnabled() && $helper->isRedirectEnabled() && !$helper->isTestMode())
|
| 22 |
+
{
|
| 23 |
+
if($helper->userNeedsToBeRedirected())
|
| 24 |
+
{
|
| 25 |
+
$this->doTheRedirect();
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
private function doTheRedirect()
|
| 32 |
+
{
|
| 33 |
+
$helper = $this->helper('afipredirect');
|
| 34 |
+
$destination_url = $helper->getDestinationWebsite();
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
if($helper->isJsRedirect())
|
| 38 |
+
{
|
| 39 |
+
echo '<script>window.location.href="'.$destination_url.'";</script>';
|
| 40 |
+
} else {
|
| 41 |
+
Mage::app()->getFrontController()->getResponse()->setRedirect($destination_url);
|
| 42 |
+
}
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
public function canShowTestPanel()
|
| 49 |
+
{
|
| 50 |
+
$helper = $this->helper('afipredirect');
|
| 51 |
+
if($helper->isEnabled() && $helper->isTestMode())
|
| 52 |
+
{
|
| 53 |
+
return true;
|
| 54 |
+
} else {
|
| 55 |
+
return false;
|
| 56 |
+
}
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+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* @author Liudas Stanevicius <liudas@creation.lt>
|
| 7 |
+
* @copyright Elsoft, UAB (www.creation.lt) <info@creation.lt>
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
class Creation_Afipredirect_Helper_Data extends Mage_Core_Helper_Abstract
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
const XML_PATH_ENABLED = 'afipredirect/settings/enable';
|
| 14 |
+
const XML_PATH_SETTINGS_JSREDIRECT = 'afipredirect/settings/jsredirect';
|
| 15 |
+
const XML_PATH_SETTINGS_IS_TEST_MODE = 'afipredirect/settings/is_test_mode';
|
| 16 |
+
const XML_PATH_SETTINGS_TEST_MODE_IP = 'afipredirect/settings/test_mode_ip';
|
| 17 |
+
const XML_PATH_SETTINGS_LOOKUP_SERVICE = 'afipredirect/settings/country_lookup_service';
|
| 18 |
+
const XML_PATH_SETTINGS_EXCLUDE_IPS = 'afipredirect/settings/exlude_ips';
|
| 19 |
+
const XML_PATH_SETTINGS_EXCLUDE_SEARCH_ENGINES = 'afipredirect/settings/exlude_search_engines';
|
| 20 |
+
const XML_PATH_REDIRECT_SOURCE_COUNTRY = 'afipredirect/redirect/source_country';
|
| 21 |
+
const XML_PATH_REDIRECT_DESTINATION_WEBSITE = 'afipredirect/redirect/destination_website';
|
| 22 |
+
const XML_PATH_REDIRECT_ENABLED = 'afipredirect/redirect/redirect_enabled';
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
public function isEnabled()
|
| 27 |
+
{
|
| 28 |
+
return Mage::getStoreConfig( self::XML_PATH_ENABLED );
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
public function isRedirectEnabled()
|
| 32 |
+
{
|
| 33 |
+
return Mage::getStoreConfig( self::XML_PATH_REDIRECT_ENABLED );
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
public function isTestMode()
|
| 37 |
+
{
|
| 38 |
+
return Mage::getStoreConfig( self::XML_PATH_SETTINGS_IS_TEST_MODE );
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
public function getExcludedIps()
|
| 42 |
+
{
|
| 43 |
+
return Mage::getStoreConfig( self::XML_PATH_SETTINGS_EXCLUDE_IPS );
|
| 44 |
+
}
|
| 45 |
+
public function getTestModeIp()
|
| 46 |
+
{
|
| 47 |
+
return Mage::getStoreConfig( self::XML_PATH_SETTINGS_TEST_MODE_IP );
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
public function getCountryLookupService()
|
| 51 |
+
{
|
| 52 |
+
return Mage::getStoreConfig( self::XML_PATH_SETTINGS_LOOKUP_SERVICE );
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
public function getSourceCountry()
|
| 56 |
+
{
|
| 57 |
+
return Mage::getStoreConfig( self::XML_PATH_REDIRECT_SOURCE_COUNTRY );
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
public function getDestinationWebsite()
|
| 61 |
+
{
|
| 62 |
+
return Mage::getStoreConfig( self::XML_PATH_REDIRECT_DESTINATION_WEBSITE );
|
| 63 |
+
}
|
| 64 |
+
public function isJsRedirect()
|
| 65 |
+
{
|
| 66 |
+
return Mage::getStoreConfig( self::XML_PATH_SETTINGS_JSREDIRECT );
|
| 67 |
+
}
|
| 68 |
+
public function getExcludedSearchEngineBots()
|
| 69 |
+
{
|
| 70 |
+
return Mage::getStoreConfig( self::XML_PATH_SETTINGS_EXCLUDE_SEARCH_ENGINES );
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
public function getVisitorsIp()
|
| 75 |
+
{
|
| 76 |
+
return Mage::helper('core/http')->getRemoteAddr();
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
public function getIpToTest()
|
| 82 |
+
{
|
| 83 |
+
$test_ip = $this->getTestModeIp();
|
| 84 |
+
if(filter_var($test_ip, FILTER_VALIDATE_IP))
|
| 85 |
+
{
|
| 86 |
+
return $test_ip;
|
| 87 |
+
} else {
|
| 88 |
+
return $this->getVisitorsIp();
|
| 89 |
+
}
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
public function getVisitorsIpCountrySession()
|
| 93 |
+
{
|
| 94 |
+
$session = Mage::getSingleton("core/session", array("name"=>"frontend"));
|
| 95 |
+
return $session->getData($this->getCountryLookupService()."_visitor_ip_country");
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
public function setVisitorsIpCountrySession($country_code)
|
| 100 |
+
{
|
| 101 |
+
$session = Mage::getSingleton("core/session", array("name"=>"frontend"));
|
| 102 |
+
$session->setData($this->getCountryLookupService()."_visitor_ip_country", $country_code);
|
| 103 |
+
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
public function isSearchEngineBot()
|
| 108 |
+
{
|
| 109 |
+
$bots = array(
|
| 110 |
+
'Googlebot', 'Baiduspider', 'ia_archiver',
|
| 111 |
+
'R6_FeedFetcher', 'NetcraftSurveyAgent', 'Sogou web spider',
|
| 112 |
+
'bingbot', 'Yahoo! Slurp', 'facebookexternalhit', 'PrintfulBot',
|
| 113 |
+
'msnbot', 'Twitterbot', 'UnwindFetchor',
|
| 114 |
+
'urlresolver', 'Butterfly', 'TweetmemeBot' );
|
| 115 |
+
|
| 116 |
+
foreach($bots as $b){
|
| 117 |
+
|
| 118 |
+
if( stripos( Mage::helper('core/http')->getHttpUserAgent(), $b ) !== false ) return true;
|
| 119 |
+
|
| 120 |
+
}
|
| 121 |
+
return false;
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
public function excludeThisVisitorFromRedirect($ip_address = false)
|
| 126 |
+
{
|
| 127 |
+
if($ip_address == false)
|
| 128 |
+
{
|
| 129 |
+
$ip_address = $this->getVisitorsIp();
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
$excluded_ips = $this->getExcludedIps();
|
| 133 |
+
|
| 134 |
+
if($excluded_ips != '')
|
| 135 |
+
{
|
| 136 |
+
$excluded_ips = explode(',',$excluded_ips);
|
| 137 |
+
|
| 138 |
+
$excluded_ips_clean = array();
|
| 139 |
+
foreach($excluded_ips as $ip)
|
| 140 |
+
{
|
| 141 |
+
$excluded_ips_clean[] = trim($ip);
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
if((count($excluded_ips_clean) > 0) && in_array($ip_address,$excluded_ips_clean))
|
| 145 |
+
{
|
| 146 |
+
return true;
|
| 147 |
+
}
|
| 148 |
+
}
|
| 149 |
+
return false;
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
public function userNeedsToBeRedirected()
|
| 154 |
+
{
|
| 155 |
+
$visitors_ip = $this->getVisitorsIp();
|
| 156 |
+
// is this visitor in the IP exlude list?
|
| 157 |
+
if($this->excludeThisVisitorFromRedirect($visitors_ip))
|
| 158 |
+
{
|
| 159 |
+
return false;
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
// check if this is not a search engine bot
|
| 163 |
+
if($this->getExcludedSearchEngineBots() && $this->isSearchEngineBot())
|
| 164 |
+
{
|
| 165 |
+
return false;
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
// has the visitor been here before?
|
| 169 |
+
$country_code = $this->getVisitorsIpCountrySession();
|
| 170 |
+
|
| 171 |
+
// if not, lookup country code and store in the session
|
| 172 |
+
if($country_code == NULL)
|
| 173 |
+
{
|
| 174 |
+
$country_code = $this->getCountryCodeByIp($visitors_ip);
|
| 175 |
+
$this->setVisitorsIpCountrySession($country_code);
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
// get config values
|
| 179 |
+
$source_countries = $this->getSourceCountry();
|
| 180 |
+
$source_countries = explode(',',$source_countries);
|
| 181 |
+
|
| 182 |
+
// match?
|
| 183 |
+
if(in_array($country_code,$source_countries))
|
| 184 |
+
{
|
| 185 |
+
return true;
|
| 186 |
+
} else {
|
| 187 |
+
return false;
|
| 188 |
+
}
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
public function getRedirectResultByIp($ip_address = false)
|
| 192 |
+
{
|
| 193 |
+
if($ip_address == false)
|
| 194 |
+
{
|
| 195 |
+
$ip_address = $this->getVisitorsIp();
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
$country_code = $this->getCountryCodeByIp($ip_address);
|
| 199 |
+
$source_countries = $this->getSourceCountry();
|
| 200 |
+
|
| 201 |
+
$source_countries = explode(',',$source_countries);
|
| 202 |
+
|
| 203 |
+
if(in_array($country_code,$source_countries))
|
| 204 |
+
{
|
| 205 |
+
return true;
|
| 206 |
+
} else {
|
| 207 |
+
return false;
|
| 208 |
+
}
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
public function getIpTestResults($ip_address)
|
| 212 |
+
{
|
| 213 |
+
$country_code = $this->getCountryCodeByIp($ip_address);
|
| 214 |
+
if($country_code != false)
|
| 215 |
+
{
|
| 216 |
+
$country_name = Mage::app()->getLocale()->getCountryTranslation($country_code);
|
| 217 |
+
if($country_name != false)
|
| 218 |
+
{
|
| 219 |
+
return $country_name.' ('.$country_code.')';
|
| 220 |
+
} else {
|
| 221 |
+
return 'Unknown ('.$country_code.')';
|
| 222 |
+
}
|
| 223 |
+
} else {
|
| 224 |
+
return 'Unknown';
|
| 225 |
+
}
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
|
| 229 |
+
public function getCountryCodeByIp($ip_address = false)
|
| 230 |
+
{
|
| 231 |
+
if($ip_address == false)
|
| 232 |
+
{
|
| 233 |
+
$ip_address = $this->getVisitorsIp();
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
$lookup_service = $this->getCountryLookupService();
|
| 237 |
+
|
| 238 |
+
switch ($lookup_service) {
|
| 239 |
+
case 'geoplugin':
|
| 240 |
+
return $this->geoplugin_visitor_country($ip_address);
|
| 241 |
+
break;
|
| 242 |
+
case 'hostip':
|
| 243 |
+
return $this->hostip_visitor_country($ip_address);
|
| 244 |
+
break;
|
| 245 |
+
case 'iptolatlng':
|
| 246 |
+
return $this->iptolatlng_visitor_country($ip_address);
|
| 247 |
+
break;
|
| 248 |
+
default:
|
| 249 |
+
return $this->iptolatlng_visitor_country($ip_address);
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
|
| 256 |
+
private function geoplugin_visitor_country($ip_address = false)
|
| 257 |
+
{
|
| 258 |
+
|
| 259 |
+
if($ip_address == false)
|
| 260 |
+
{
|
| 261 |
+
$ip_address = $this->getVisitorsIp();
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
$result = false;
|
| 265 |
+
|
| 266 |
+
$ip_data = @json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip=".$ip));
|
| 267 |
+
if($ip_data && $ip_data->geoplugin_countryCode != null)
|
| 268 |
+
{
|
| 269 |
+
$result = $ip_data->geoplugin_countryCode;
|
| 270 |
+
}
|
| 271 |
+
return $result;
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
private function hostip_visitor_country($ip_address = false)
|
| 275 |
+
{
|
| 276 |
+
|
| 277 |
+
if($ip_address == false)
|
| 278 |
+
{
|
| 279 |
+
$ip_address = $this->getVisitorsIp();
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
$result = false;
|
| 283 |
+
|
| 284 |
+
$ip_data = @file_get_contents("http://api.hostip.info/country.php?ip=".$ip_address);
|
| 285 |
+
|
| 286 |
+
if($ip_data && $ip_data != null)
|
| 287 |
+
{
|
| 288 |
+
$result = $ip_data;
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
return $result;
|
| 292 |
+
}
|
| 293 |
+
|
| 294 |
+
private function iptolatlng_visitor_country($ip_address = false)
|
| 295 |
+
{
|
| 296 |
+
if($ip_address == false)
|
| 297 |
+
{
|
| 298 |
+
$ip_address = $this->getVisitorsIp();
|
| 299 |
+
}
|
| 300 |
+
|
| 301 |
+
$result = false;
|
| 302 |
+
|
| 303 |
+
$ip_data = @json_decode(file_get_contents("http://www.iptolatlng.com?ip=".$ip_address."&type=json"));
|
| 304 |
+
|
| 305 |
+
if($ip_data && $ip_data->country != null)
|
| 306 |
+
{
|
| 307 |
+
$result = $ip_data->country;
|
| 308 |
+
}
|
| 309 |
+
|
| 310 |
+
return $result;
|
| 311 |
+
}
|
| 312 |
+
|
| 313 |
+
|
| 314 |
+
|
| 315 |
+
}
|
| 316 |
+
?>
|
app/code/local/Creation/Afipredirect/etc/adminhtml.xml
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<acl>
|
| 4 |
+
<resources>
|
| 5 |
+
<admin>
|
| 6 |
+
<children>
|
| 7 |
+
<system>
|
| 8 |
+
<children>
|
| 9 |
+
<config>
|
| 10 |
+
<children>
|
| 11 |
+
<afipredirect>
|
| 12 |
+
<title>AfIpRedirect configuration</title>
|
| 13 |
+
</afipredirect>
|
| 14 |
+
</children>
|
| 15 |
+
</config>
|
| 16 |
+
</children>
|
| 17 |
+
</system>
|
| 18 |
+
</children>
|
| 19 |
+
</admin>
|
| 20 |
+
</resources>
|
| 21 |
+
</acl>
|
| 22 |
+
</config>
|
app/code/local/Creation/Afipredirect/etc/config.xml
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<default>
|
| 4 |
+
<afipredirect>
|
| 5 |
+
<settings>
|
| 6 |
+
<enable>0</enable>
|
| 7 |
+
<is_test_mode>0</is_test_mode>
|
| 8 |
+
<jsredirect>0</jsredirect>
|
| 9 |
+
<exlude_search_engines>1</exlude_search_engines>
|
| 10 |
+
<country_lookup_service>iptolatlng</country_lookup_service>
|
| 11 |
+
</settings>
|
| 12 |
+
</afipredirect>
|
| 13 |
+
</default>
|
| 14 |
+
|
| 15 |
+
<modules>
|
| 16 |
+
<Creation_Afipredirect>
|
| 17 |
+
<version>0.0.3</version>
|
| 18 |
+
</Creation_Afipredirect>
|
| 19 |
+
</modules>
|
| 20 |
+
<global>
|
| 21 |
+
<blocks>
|
| 22 |
+
<afipredirect>
|
| 23 |
+
<class>Creation_Afipredirect_Block</class>
|
| 24 |
+
</afipredirect>
|
| 25 |
+
</blocks>
|
| 26 |
+
<helpers>
|
| 27 |
+
<afipredirect>
|
| 28 |
+
<class>Creation_Afipredirect_Helper</class>
|
| 29 |
+
</afipredirect>
|
| 30 |
+
</helpers>
|
| 31 |
+
<models>
|
| 32 |
+
<afipredirect>
|
| 33 |
+
<class>Creation_Afipredirect_Model</class>
|
| 34 |
+
</afipredirect>
|
| 35 |
+
<afipredirect_adminhtml>
|
| 36 |
+
<class>Creation_Afipredirect_Adminhtml_Model</class>
|
| 37 |
+
</afipredirect_adminhtml>
|
| 38 |
+
</models>
|
| 39 |
+
</global>
|
| 40 |
+
<frontend>
|
| 41 |
+
<layout>
|
| 42 |
+
<updates>
|
| 43 |
+
<afipredirect module="Creation_Afipredirect">
|
| 44 |
+
<file>afipredirect.xml</file>
|
| 45 |
+
</afipredirect>
|
| 46 |
+
</updates>
|
| 47 |
+
</layout>
|
| 48 |
+
</frontend>
|
| 49 |
+
</config>
|
app/code/local/Creation/Afipredirect/etc/system.xml
ADDED
|
@@ -0,0 +1,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|
+
<creation translate="label" module="afipredirect">
|
| 5 |
+
<label>Creation Extensions</label>
|
| 6 |
+
<sort_order>300</sort_order>
|
| 7 |
+
</creation>
|
| 8 |
+
</tabs>
|
| 9 |
+
<sections>
|
| 10 |
+
<afipredirect translate="label" module="afipredirect">
|
| 11 |
+
<label>Visitor Country IP Redirect</label>
|
| 12 |
+
<tab>creation</tab>
|
| 13 |
+
<frontend_type>text</frontend_type>
|
| 14 |
+
<sort_order>600</sort_order>
|
| 15 |
+
<show_in_default>1</show_in_default>
|
| 16 |
+
<show_in_website>1</show_in_website>
|
| 17 |
+
<show_in_store>1</show_in_store>
|
| 18 |
+
|
| 19 |
+
<groups>
|
| 20 |
+
<settings>
|
| 21 |
+
<label>Settings</label>
|
| 22 |
+
<sort_order>1</sort_order>
|
| 23 |
+
<show_in_default>1</show_in_default>
|
| 24 |
+
<show_in_website>1</show_in_website>
|
| 25 |
+
<show_in_store>1</show_in_store>
|
| 26 |
+
<comment><![CDATA[The aim of this extension is to redirect your store visitors to an anoteher URL based on their country.]]></comment>
|
| 27 |
+
<fields>
|
| 28 |
+
<enable>
|
| 29 |
+
<label>Extension Enabled</label>
|
| 30 |
+
<comment>
|
| 31 |
+
<![CDATA[Enable or Disable this extension.]]>
|
| 32 |
+
</comment>
|
| 33 |
+
<frontend_type>select</frontend_type>
|
| 34 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 35 |
+
<sort_order>1</sort_order>
|
| 36 |
+
<show_in_default>1</show_in_default>
|
| 37 |
+
<show_in_website>1</show_in_website>
|
| 38 |
+
<show_in_store>1</show_in_store>
|
| 39 |
+
</enable>
|
| 40 |
+
<country_lookup_service translate="label comment">
|
| 41 |
+
<label>Country lookup service</label>
|
| 42 |
+
<comment>
|
| 43 |
+
<![CDATA[To find out which country the visitor is from, we use remote lookup services.]]>
|
| 44 |
+
</comment>
|
| 45 |
+
<frontend_type>select</frontend_type>
|
| 46 |
+
<source_model>afipredirect_adminhtml/system_config_source_countrylookupproviders</source_model>
|
| 47 |
+
<backend_model>afipredirect_adminhtml/system_config_source_countrylookupproviders</backend_model>
|
| 48 |
+
<sort_order>30</sort_order>
|
| 49 |
+
<show_in_default>1</show_in_default>
|
| 50 |
+
<show_in_website>1</show_in_website>
|
| 51 |
+
<show_in_store>1</show_in_store>
|
| 52 |
+
</country_lookup_service>
|
| 53 |
+
<jsredirect>
|
| 54 |
+
<label>Use Javascript redirect?</label>
|
| 55 |
+
<comment>
|
| 56 |
+
<![CDATA[Matched users will be redirected with Javascript. If above option is set to NO - then there will he a PHP redirect.]]>
|
| 57 |
+
</comment>
|
| 58 |
+
<frontend_type>select</frontend_type>
|
| 59 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 60 |
+
<sort_order>60</sort_order>
|
| 61 |
+
<show_in_default>1</show_in_default>
|
| 62 |
+
<show_in_website>1</show_in_website>
|
| 63 |
+
<show_in_store>1</show_in_store>
|
| 64 |
+
</jsredirect>
|
| 65 |
+
<exlude_ips translate="label comment">
|
| 66 |
+
<label>Exclude IP addresses</label>
|
| 67 |
+
<comment>
|
| 68 |
+
<![CDATA[Comma separated IP addresses. Visitors, with these IP addresses will be exluded from redirect. Most likely you would want to put your IP here.]]>
|
| 69 |
+
</comment>
|
| 70 |
+
<frontend_type>text</frontend_type>
|
| 71 |
+
<sort_order>61</sort_order>
|
| 72 |
+
<show_in_default>1</show_in_default>
|
| 73 |
+
<show_in_website>1</show_in_website>
|
| 74 |
+
<show_in_store>1</show_in_store>
|
| 75 |
+
</exlude_ips>
|
| 76 |
+
<exlude_search_engines translate="label comment">
|
| 77 |
+
<label>Exclude search engines</label>
|
| 78 |
+
<comment>
|
| 79 |
+
<![CDATA[Exclude search engine bots like Googlebot, Baiduspider, ia_archiver, R6_FeedFetcher, NetcraftSurveyAgent, Sogou web spider, bingbot, Yahoo! Slurp, facebookexternalhit, PrintfulBot, msnbot, Twitterbot, UnwindFetchor, urlresolver, Butterfly, TweetmemeBot from redirect.]]>
|
| 80 |
+
</comment>
|
| 81 |
+
<frontend_type>select</frontend_type>
|
| 82 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 83 |
+
<sort_order>62</sort_order>
|
| 84 |
+
<show_in_default>1</show_in_default>
|
| 85 |
+
<show_in_website>1</show_in_website>
|
| 86 |
+
<show_in_store>1</show_in_store>
|
| 87 |
+
</exlude_search_engines>
|
| 88 |
+
<is_test_mode translate="label comment">
|
| 89 |
+
<label>Test mode</label>
|
| 90 |
+
<comment>
|
| 91 |
+
<![CDATA[If extension is enabled and test mode activated, in front end you will be able to see where the visitor will be redirected to. This is not recommended on a production environment.]]>
|
| 92 |
+
</comment>
|
| 93 |
+
<frontend_type>select</frontend_type>
|
| 94 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 95 |
+
<sort_order>20</sort_order>
|
| 96 |
+
<show_in_default>1</show_in_default>
|
| 97 |
+
<show_in_website>1</show_in_website>
|
| 98 |
+
<show_in_store>1</show_in_store>
|
| 99 |
+
</is_test_mode>
|
| 100 |
+
<test_mode_ip translate="label comment">
|
| 101 |
+
<label>Test IP address</label>
|
| 102 |
+
<comment>Enter a test visitor IP address.</comment>
|
| 103 |
+
<frontend_type>text</frontend_type>
|
| 104 |
+
<sort_order>21</sort_order>
|
| 105 |
+
<show_in_default>1</show_in_default>
|
| 106 |
+
<show_in_website>1</show_in_website>
|
| 107 |
+
<show_in_store>1</show_in_store>
|
| 108 |
+
<depends>
|
| 109 |
+
<is_test_mode>1</is_test_mode>
|
| 110 |
+
</depends>
|
| 111 |
+
</test_mode_ip>
|
| 112 |
+
</fields>
|
| 113 |
+
</settings>
|
| 114 |
+
<redirect>
|
| 115 |
+
<label>Redirect</label>
|
| 116 |
+
<sort_order>2</sort_order>
|
| 117 |
+
<show_in_default>1</show_in_default>
|
| 118 |
+
<show_in_website>1</show_in_website>
|
| 119 |
+
<show_in_store>1</show_in_store>
|
| 120 |
+
<fields>
|
| 121 |
+
<redirect_enabled>
|
| 122 |
+
<label>Redirect enabled</label>
|
| 123 |
+
<frontend_type>select</frontend_type>
|
| 124 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 125 |
+
<sort_order>10</sort_order>
|
| 126 |
+
<show_in_default>1</show_in_default>
|
| 127 |
+
<show_in_website>1</show_in_website>
|
| 128 |
+
<show_in_store>1</show_in_store>
|
| 129 |
+
</redirect_enabled>
|
| 130 |
+
|
| 131 |
+
<source_country>
|
| 132 |
+
<label>Visitor country</label>
|
| 133 |
+
<comment>
|
| 134 |
+
<![CDATA[If a user is from any of these countries...]]>
|
| 135 |
+
</comment>
|
| 136 |
+
<frontend_type>multiselect</frontend_type>
|
| 137 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
| 138 |
+
<sort_order>40</sort_order>
|
| 139 |
+
<show_in_default>1</show_in_default>
|
| 140 |
+
<show_in_website>1</show_in_website>
|
| 141 |
+
<show_in_store>1</show_in_store>
|
| 142 |
+
</source_country>
|
| 143 |
+
<destination_website>
|
| 144 |
+
<label>Redirect to URL</label>
|
| 145 |
+
<comment>
|
| 146 |
+
<![CDATA[..redirect him to this URL (example http://www.google.com).]]>
|
| 147 |
+
</comment>
|
| 148 |
+
<frontend_type>text</frontend_type>
|
| 149 |
+
<sort_order>50</sort_order>
|
| 150 |
+
<show_in_default>1</show_in_default>
|
| 151 |
+
<show_in_website>1</show_in_website>
|
| 152 |
+
<show_in_store>1</show_in_store>
|
| 153 |
+
</destination_website>
|
| 154 |
+
|
| 155 |
+
</fields>
|
| 156 |
+
</redirect>
|
| 157 |
+
</groups>
|
| 158 |
+
</afipredirect>
|
| 159 |
+
</sections>
|
| 160 |
+
</config>
|
app/design/frontend/default/default/layout/afipredirect.xml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<layout version="0.1.0">
|
| 3 |
+
<default>
|
| 4 |
+
<reference name="after_body_start">
|
| 5 |
+
<block type="afipredirect/ipredirect" name="ipredirect" as="afipredirect" template="afipredirect/ipredirect.phtml" />
|
| 6 |
+
</reference>
|
| 7 |
+
</default>
|
| 8 |
+
</layout>
|
app/design/frontend/default/default/template/afipredirect/ipredirect.phtml
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* @category Creation
|
| 4 |
+
* @package Creation_Afipredirect
|
| 5 |
+
* @author Liudas Stanevicius <liudas@creation.lt>
|
| 6 |
+
* @copyright Elsoft, UAB (www.creation.lt) <info@creation.lt>
|
| 7 |
+
*/
|
| 8 |
+
?>
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
<?php
|
| 12 |
+
$helper = Mage::helper('afipredirect');
|
| 13 |
+
?>
|
| 14 |
+
|
| 15 |
+
<?php if($this->canShowTestPanel()): ?>
|
| 16 |
+
<div class="afipredirect_testmode">
|
| 17 |
+
<h4><?php echo __('Visitor Country IP redirect testing panel'); ?></h4>
|
| 18 |
+
<?php echo __('Tested IP address'); ?>: <strong><?php echo $helper->getIpToTest(); ?></strong><br />
|
| 19 |
+
(<i><?php echo __('note, that your IP address is %s', $helper->getVisitorsIp()); ?></i>)<br />
|
| 20 |
+
<?php echo __('Lookup service'); ?>: <strong><?php echo $helper->getCountryLookupService(); ?></strong><br />
|
| 21 |
+
<?php echo __('Country by IP'); ?>: <strong><?php echo $helper->getIpTestResults($helper->getIpToTest()); ?></strong><br />
|
| 22 |
+
<?php echo __('Is search engine bot?'); ?>:
|
| 23 |
+
|
| 24 |
+
<?php if($helper->isSearchEngineBot()): ?>
|
| 25 |
+
<strong><?php echo __('yes'); ?></strong>
|
| 26 |
+
<?php else: ?>
|
| 27 |
+
<strong><?php echo __('no'); ?></strong>
|
| 28 |
+
<?php endif; ?>
|
| 29 |
+
<br />
|
| 30 |
+
<?php echo __('Would user be redirected to %s?', $helper->getDestinationWebsite()); ?>: <strong><?php if($helper->getRedirectResultByIp($helper->getIpToTest())): ?><?php echo __('yes'); ?><?php else: ?><?php echo __('no'); ?><?php endif; ?></strong>
|
| 31 |
+
</div>
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
<style type="text/css">
|
| 35 |
+
div.afipredirect_testmode {
|
| 36 |
+
font-family: Arial;
|
| 37 |
+
font-size: 12px;
|
| 38 |
+
text-align: left;
|
| 39 |
+
margin: 0px auto;
|
| 40 |
+
padding: 10px;
|
| 41 |
+
position: fixed;
|
| 42 |
+
width: 300px;
|
| 43 |
+
background-color: red;
|
| 44 |
+
color: white;
|
| 45 |
+
bottom: 0px;
|
| 46 |
+
}
|
| 47 |
+
div.afipredirect_testmode h4{
|
| 48 |
+
color: white;
|
| 49 |
+
fonct-size: 14px;
|
| 50 |
+
padding: 0px 0px 10px 0px;
|
| 51 |
+
margin: 0px;
|
| 52 |
+
}
|
| 53 |
+
</style>
|
| 54 |
+
|
| 55 |
+
<?php endif; ?>
|
app/etc/modules/Creation_Afipredirect.xml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Creation_Afipredirect>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>local</codePool>
|
| 7 |
+
</Creation_Afipredirect>
|
| 8 |
+
</modules>
|
| 9 |
+
</config>
|
package.xml
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>visitor_country_ip_redirect</name>
|
| 4 |
+
<version>0.0.3</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL 3.0)</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>Redirect your store visitors to an anoteher URL based on their source country (IP address).</summary>
|
| 10 |
+
<description>This extension is perfect if you have a few stores with different prices and you don't want visitors from one country to browse other country's products.
|
| 11 |
+

|
| 12 |
+
Visitor's country code is obtained from visitor's IP address by getting data from remote data sources that you are able to choose from:
|
| 13 |
+
* geoplugin.net
|
| 14 |
+
* hostip.info
|
| 15 |
+
* iptolatlng.com
|
| 16 |
+

|
| 17 |
+
Extension has some configuration options:
|
| 18 |
+
* test mode;
|
| 19 |
+
* redirect type (PHP/JavaScript);
|
| 20 |
+
* exclude specific IP addresses from redirect;
|
| 21 |
+
* exclude search engine bots from redirect;
|
| 22 |
+
* etc.
|
| 23 |
+

|
| 24 |
+
Extension is tested on versions 1.7+, but it could work with older versions as well.</description>
|
| 25 |
+
<notes>Initial release.</notes>
|
| 26 |
+
<authors><author><name>Liudas Stanevicius</name><user>liudass</user><email>liudas@creation.lt</email></author></authors>
|
| 27 |
+
<date>2014-02-11</date>
|
| 28 |
+
<time>17:21:53</time>
|
| 29 |
+
<contents><target name="magelocal"><dir name="Creation"><dir name="Afipredirect"><dir name="Adminhtml"><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="Countrylookupproviders.php" hash="fce050c58e2ead60c11ffed8523b5b6d"/></dir></dir></dir></dir></dir><dir name="Block"><file name="Ipredirect.php" hash="f5fe243b7d1f79e4f19d4d2062d6ff4c"/></dir><dir name="Helper"><file name="Data.php" hash="0e5d96af04b074a76492897e8136b084"/></dir><dir name="etc"><file name="adminhtml.xml" hash="15bcd845fe1ed7a4c692632aea3392ca"/><file name="config.xml" hash="04f5cf9ab99f31e5b36c4af0a5727692"/><file name="system.xml" hash="ba0102b13ed115dfea9a2a0084505777"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="afipredirect"><file name="ipredirect.phtml" hash="09604fcc521fd5346800829ea4dca3fb"/></dir></dir><dir name="layout"><file name="afipredirect.xml" hash="4f48f9deb8bffcdefaee4b1b07e6a842"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Creation_Afipredirect.xml" hash="3c92fb37c92042cf2c759f0180596b3d"/></dir></target></contents>
|
| 30 |
+
<compatible/>
|
| 31 |
+
<dependencies><required><php><min>5.2.0</min><max>5.9.0</max></php></required></dependencies>
|
| 32 |
+
</package>
|
