3
votes

I have Magento 1.7.0.2

My problem is in language switch from store views.

I have enabled mod_rewrite, and enabled store code to urls. But language switch doesn't work correctly. Example : http://mysite.com/en/ - Default page

When i want to change language in french the url in language switch looks : http://mysite.com/en/?___store=fr

And it doesnt works I found that switcher is situated in:

app/design/frontend/default/mytheme/template/page/switch/languages.phtml

But i dont know how to change the code to make it work correctly.

When i want to change language, need to have this url : http://mysite.com/fr without ?___store=fr. Thanks in advance.

1
Solved it. The problem was in languages.phtml because it was file of theme, so i changed it with default. now all works correctly.Leanid Herasimau

1 Answers

7
votes

If you look into /app/code/core/Mage/Core/Model/Store.php you see following function:

public function getCurrentUrl($fromStore = true)

So without changing any core code grab /app/design/frontend/base/default/ template/page/switch/languages.phtml

Change the line

<option value="<?php echo $_lang->getCurrentUrl() ?>"<?php echo $_selected ?>><?php echo $this->htmlEscape($_lang->getName()) ?></option> 

to

<option value="<?php echo $_lang->getCurrentUrl(false) ?>"<?php echo $_selected ?>><?php echo $this->htmlEscape($_lang->getName()) ?></option> 

and put the changed file into the corresponding path of your theme folder.

And now you have clean URLs.