Wednesday, November 21, 2012

magento:IP SPECIFIC LANGUAGE

 First download currency switcher from   
 http://www.magentocommerce.com/magento-connect/auto-currency-switcher-8671.html  
 //CODE TO DISPLAY LANGUAGE ACCORDING TO IP ADDRESS  
  if(Mage::getConfig()->getModuleConfig('Chapagain_AutoCurrency')->is('active', 'true'))  
  {   
                $geoIp = Mage::helper('autocurrency')->loadGeoIp();  
                $ipAddress = Mage::helper('autocurrency')->getIpAddress();  
                // get country code from ip address  
                 $countryCode = geoip_country_code_by_addr($geoIp, $ipAddress);   
                 $germancountries=array('CH','DE');  
                if(!isset($_COOKIE['frontstoreloc']))   
                {   
                 //$siteurl= $this->getUrl();  
                 $siteurl= "http://".$_SERVER['SERVER_NAME'];  
                      setcookie("frontstoreloc",session_id(),time()+60*60*24,"/","");  
                     switch(trim($countryCode))  
                     {  
                           case 'CH':  
                                    $url = $siteurl . '?___store=german';  
                                    header( 'Location:' . $url);die;  
                           break;  
                           case 'DE':  
                                         $url = $siteurl . '?___store=german';  
                                         header( 'Location:' . $url);die;  
                           break;  
                           case 'IN':  
                                     $url = $siteurl . '?___store=english';  
                                     header( 'Location:' . $url);die;  
                           break;  
                           default:  
                           $url = $siteurl . '?___store=usa';  
                                     header( 'Location:' . $url);die;  
                           break;  
                     }  
                 }  
            }  

2 comments:

  1. Magneto is one of the powerful development tool and you can develop website templates, modules and especially Geoip Magneto extension module. Geoip magneto extension tool is one the good IP locker and you can lock to one or more countries and products with using this module.

    ReplyDelete
  2. Adding to subject this extension https://www.magestyapps.com/magento-extensions/geoip-currency-auto-switcher.html will be great way to get international

    ReplyDelete