0

Since I have upgraded my website to Magento 2.2.0 (from 2.1.9), the store view switch stopped working on all the pages save for the homepage and the contact page.

I have 2 store views for 2 languages, and whenever I am on a page and I try to switch to the other language version of that page, I get a 404.

How to make this switcher work again?

  • The problem also persists when I disable my theme and use Luma, so the problem is not related to my theme. – Kawa Oct 31 '17 at 11:40
0

As @mkotov writes.. the issue is tracked and solved.

For now, if you want, you could go in

magento2/app/code/Magento/Store/Model/Store.php (Magento installation by Github)

or

vendor/magento/module-store/Model/Store.php (Magento installation by composer)

and replace the second row in

public function getCurrentUrl($fromStore = true)

$requestString = $this->_url->escape(ltrim($this->_request->getRequestString(), '/'));

with

$requestString = $this->_url->escape(
    preg_replace(
        '/\?.*?$/',
        '',
        ltrim($this->_request->getRequestString(), '/')
    )
);
1

Issue is tracked internally under MAGETWO-80517 and will likely be included in 2.2.2 release. The root cause is that the ?___store=(store code) param is duplicated in the url when switching storeviews. You can remove the extra param manually to work-around the issue.

  • Can you please indicate how to remove it manually? – Kawa Nov 1 '17 at 19:36
  • You should see it in the url. Manually remove it from the url in the browser. – mkotov Nov 3 '17 at 3:07
  • Nope there isn't such parameter appearing in the URL. The URL is normally rewritten into what I've defined, it just leads to a 404 when I switch to the other language. – Kawa Nov 6 '17 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.