php - Language Switching in Magento -


Thanks in advance,

I'm new to Magento and to change languages ​​for users need help. When a customer goes to my website, their IP should be used to determine its country and the language must be properly switched. For example, if I am leaving France then my site should be displayed in French If any other person tries from any country then the website should be in the local language of that country ..

- GET

I have done once for the customer

Prerequisites: The GOIP library for PHP.

1- Create a store view relative to the languages ​​in your Magento admin.

2- Add a filtering system by:

2a - The page of your main / original topic. Edit the Xml layout file and add the line around 35/36 (Add to handle:

  block type = "page / html" name = "country-filter" Output = "toHtml" template = "page / html / country-filter.phtml" />  

2b - a template / page / html / country- in your main / Create filter.phtml and enter this code that can be changed depending on your needs:

  if $! = $ _SERVER ['REMOTE_ADDR!' ($ _COOKIE ['front end']) {Setkey ("frontend", session_id), time () + 60 * 60 * $ Country = geoip_country_name_by_name ($ ip); switch ($ country) {case 'France': $ url = $ this- & gt; getUrl (). '? ___ store = YOUR_STORE_VIEW_CODE_FOR_FRANCE' ; Header ('location:' $. Url); / * (perhaps "exit;" add here) * / break; // (etc ... er cases for othe) default: break; / * country / No need to specify store view as default because you have System & gt; Manage Store in your Magento backend. * /}}  

Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -