1

My problem is that I have three store views and I set three languages view from admin. In frontend when I click on second language it work than i click on third language url it give error and not redirect.

Url: https://telecarsi.de

Please click on language pop twice then it give error i want to switch language.

4
  • now check var/report Jan 3 '18 at 11:50
  • Magento\\Framework\\App\\Http->launch()\n#16 \/home\/telecars\/public_html\/index.php(39): Magento\\Framework\\App\\Bootstrap->run(Object(Magento\\Framework\\App\\Http))\n#17 {main}","url":"\/?___store=default?___store=english","script_name":"\/index.php"}
    – Monu Kumar
    Jan 3 '18 at 11:56
  • error above comment
    – Monu Kumar
    Jan 3 '18 at 11:56
  • I cant see any error there on language popup Oct 30 '18 at 6:38
0

This is a Magento 2 issue.

See: https://github.com/magento/magento2/issues/10908

What is you Magento version? It's maybe resolved in latest version 2.2.2.

1
  • I can't comment his answer but Indranil Maity answer's is not a good way to me because it will always redirect to home. Jan 3 '18 at 12:09
0

This is a Magento 2.2.0 bug.

To fix it, upgrade to the latest version, or temporarily fix it by changing the getTargetStorePostData function in:

/vendor/magento/module-store/Block/Switcher.php

Change it to:

public function getTargetStorePostData(\Magento\Store\Model\Store $store, $data = [])
{
    $data[\Magento\Store\Api\StoreResolverInterface::PARAM_NAME] = $store->getCode();
    return $this->_postDataHelper->getPostData(
        //$store->getCurrentUrl(false),
        $this->getUrl('stores/store/switch'),
        $data
    );
}
0

I am also having this problem before. After that I tried this which works fine for me.

Try this -

You can see languages.phtml file under templates/switch folder.

Replace this code:

<a href="#" data-post='<?php echo $this->getTargetStorePostData($_lang); ?>'>

With :

<a href="<?php echo $_lang->getHomeUrl();  ?>">

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.