The problem i faced and didn’t find any solution in internet.
But a lot of questions around it on many resources.
Even the corresponded thread in official ocStroe blog was without answer. (the last answer in this thread is mine now)
So be stright. The solution not so complicated and almost all changes we have to do in index.php and few files more
For the beginning let’s just have a look to the .htacces file to understand how the engine work with the requests
Look at this lines: if request is not an existed file the apache take the request and put it into a GET parameter _route_. Me personaly think that it is not a nice decision but we have what we have. We are not going to rewrite the engine. Just make some adjustments.
If we look at the index.php file we will find there a section of Language Detection
It is clear that language code stored in a session variable. If not the language detection algorithm is started.
We need to get language code from URL and set session variable before this process. Not only get language code but cut it – edit _request_variable.
But if theres no language code in URL we have to set the default language.
here is what I wrote in index.php file (line 121)
Hope no need to explain.
The last 2 Lines – i moved them frpom the upper part of the file. This is for change all urls on the website to language guided format.
Now we should change language dropdown box – according to our changes in index.php file.
/catalog/controler/common/language.php controller
I rewrote some part of the code so now it looks like this:
It is quite obvious which part i edited. If you open the file you will see it.
Now template /common/language.tpl
I will not post here the source code – Just put $uri variable in a href atribute of the each link instead of $code
And the last one:
comment this code:
$('#language a').on('click', function(e) {...in a /catalog/view/javascript/common.js file
Here is archive with the edited files ocstore_lang_fix.zip
That’s all
I’m not pretending that it is the best solution or there’s no bags but it is defenetly working soliution that may be upgraded fixed or else. I made it with the 2.1 version but the main idea is important. I did’t check yet but shure the same could be done in other version of ocStore
thanks!