Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Magento 2.2 language switching not working on catalog and Product Pages #11963

Closed
Yan-Studio-WEB opened this issue Nov 2, 2017 · 28 comments
Closed
Assignees
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Comments

@Yan-Studio-WEB
Copy link

Preconditions

  1. Magento Clean Install 2.2
  2. More than one store views English and Greek

Steps to reproduce

  1. got o this page: https://www.nuovamoda.fashion/el/papoutsia/mpotes.html
  2. Try To change Language

Expected result

  1. Go to desired Language

Actual result

  1. Stay in the same Language
@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Nov 2, 2017
@mhauri
Copy link

mhauri commented Nov 2, 2017

Tested it on a clean Magento 2.2 installation with another store view configured and "Add Store Code to Urls" enabled. It works fine in "development" mode, but doesn't work in "production" mode.

@Yan-Studio-WEB
Copy link
Author

Yan-Studio-WEB commented Nov 3, 2017

Hi Mhauri
Thanks for your Response and your time
Is it Possible to be fixed?
Thanks In Advance

@magento-engcom-team
Copy link
Contributor

Hello @iWEBproject. Thanks for reporting. Would You please provide us detailed steps of how You set two store views.

@Yan-Studio-WEB
Copy link
Author

Hello
Yes of course I will try to describe

  1. I upload compressed file el_GR.zip and Unzip in to this path: app/i18n/mageplaza/el_GR/
  2. I Flush Magento Cache
  3. I set up the store Views For English and Greek (I set up Greek as default) See Images also
    stores
    sores 2
  4. I change URL Options (was not working Corrct before I do That) see image
    url options
  5. I Flush Magento Cache
  6. I duplicate blogs and pages for both languages
    Done

@magento-engcom-team
Copy link
Contributor

@iWEBproject, thank you for your report.
We've created internal ticket(s) MAGETWO-83549 to track progress on the issue.

@magento-engcom-team magento-engcom-team added 2.2.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed labels Nov 9, 2017
@king-themes
Copy link

king-themes commented Nov 11, 2017

The same problem here in fresh install of 2.2.1 with Stores > Configuration > Web > Url Options > Add Store Code to Urls = Yes.

@ghost
Copy link

ghost commented Nov 18, 2017

I have the same issue with 2.2.1 version.

Hope a solution.

@ghost
Copy link

ghost commented Nov 19, 2017

I see that the issue is fixed on you website https://www.nuovamoda.fashion/el/papoutsia/mpotes.html. How can i fix it please?

thank you in advance.

@Yan-Studio-WEB
Copy link
Author

Hi achatpc
Is not fixed my friend I wish....
go and check: https://www.nuovamoda.fashion/el/papoutsia/mpotes

@ferret-e
Copy link

The same in 2.2.1, buth in production and developer modes.

@klimart
Copy link
Contributor

klimart commented Dec 15, 2017

The issue occurs in these places:

vendor/magento/module-catalog/Controller/Category/View.php
	public function execute()
	155: if ($this->_request->getParam(\Magento\Framework\App\ActionInterface::PARAM_NAME_URL_ENCODED))

vendor/magento/module-catalog/Controller/Product/View.php
	public function execute()
	79: if ($this->getRequest()->isPost() && $this->getRequest()->getParam(self::PARAM_NAME_URL_ENCODED))

Not completely sure if it should be the correct fix, but additional condition like && !$this->getRequest()->getParam('___from_store') can resolve this issue

vendor/magento/module-catalog/Controller/Category/View.php
	public function execute()
	155: if ($this->_request->getParam(\Magento\Framework\App\ActionInterface::PARAM_NAME_URL_ENCODED) && !$this->_request->getParam('___from_store')) {

vendor/magento/module-catalog/Controller/Product/View.php
	public function execute()
	79: if ($this->getRequest()->isPost() && $this->getRequest()->getParam(self::PARAM_NAME_URL_ENCODED) && !$this->getRequest()->getParam('___from_store')) {

@ghost
Copy link

ghost commented Dec 16, 2017 via email

@irfanMukhtar
Copy link

hi @klimart thanks for the solution. i have implemented your solution in my magento 2.2.1 and it is not working. i have tested this solution on "default", "developer" and "production" mode as well.
@p-bystritsky hi, do you have any update regarding this issue ? thanks

@klimart
Copy link
Contributor

klimart commented Dec 28, 2017

Hello @irfanMukhtar it's seems strange, as for me fix works in 2.2.2 version, but I don't observe any core code changes in these files from 2.2.0 version, so it should work for 2.2.1 and 2.2.0 too.
I've created git patch for this issue with my changes
https://github.com/klimart/magento2-patches/blob/master/patches/11963-language-issue.patch

@irfanMukhtar
Copy link

Thanks a lot @klimart. I have implemented you patch in my magento 2.2 and it is working fine. Now language is switching on catalog and product page. Great work 👍

@p-bystritsky
Copy link
Contributor

Can also confirm it works fine on 2.2-develop branch.

@moleculech
Copy link

Maybe this helps someone...
We needed to add an extra parameter (___store) to the fix from @klimart to make it work (in 2.2.1)
/home/www/nahrin/htdocs/vendor/magento/module-catalog/Controller/Product/View.php: Line 79

if ($this->getRequest()->isPost() && $this->getRequest()->getParam(self::PARAM_NAME_URL_ENCODED) && !$this->getRequest()->getparam('___store')) {

/home/www/nahrin/htdocs/vendor/magento/module-catalog/Controller/Category/View.php: Line 155

if ($this->_request->getParam(\Magento\Framework\App\ActionInterface::PARAM_NAME_URL_ENCODED) && !$this->getRequest()->getparam('___store')) {

@Yan-Studio-WEB
Copy link
Author

Yan-Studio-WEB commented Jan 9, 2018

Hi klimart and Happy New Year
I just Modify both View.php in the paths you described
Result Product Page Is working
Category Page is not working
Version Of Magento is Clean 2.2.2
https://www.nuovamoda.fashion/el/gynaikeia-papoutsia/mpotes.html

@ferret-e
Copy link

ferret-e commented Jan 20, 2018

2.2.2, the same. Applied klimart's patch but language not switched - page simply reloading to the same lang when "Add Store Code to Urls" is on.

@pfandrade
Copy link

I also confirm the @klimart patch is working on 2.2.2. Thanks!

@SherifElfadaly
Copy link

@moleculech Tested with 2.2.1 and working fine in category and product put not working in catalog search result.

@koenner01
Copy link
Contributor

I can also confirm this is a problem in 2.1.11
Will try the suggested fix from above

@blizam
Copy link

blizam commented Feb 11, 2018

I can confirm the issue in 2.2.2 and also that the fix posted by @klimart and in the 13534 pr resolves the issue. I didn't test catalog search results prior to patching my site but I am able to use the language switcher properly on catalog search results (as well as category pages and product detail pages) after the patch.

I really hope this makes it into 2.2.3 as it's a "big deal" IMO :)

//anyone not successful with the patch here probably just needs to flush their caches/static-view/preprocessed files

@magento-engcom-team
Copy link
Contributor

magento-engcom-team commented Feb 15, 2018

Hi @iWEBproject. Thank you for your report.
The issue has been fixed in magento-engcom/magento2ce#1143 by @p-bystritsky in 2.2-develop branch
Related commit(s):

The fix will be available with the upcoming 2.2.4 release.

@magento-engcom-team magento-engcom-team added the Fixed in 2.2.x The issue has been fixed in 2.2 release line label Feb 15, 2018
@bobemoe
Copy link
Contributor

bobemoe commented Apr 4, 2018

I can confirm the same issue on 2.1.12 and that the fix provided by #11963 (comment) has fixed the issue.

Is there a backport planned for 2.1? Or another ticket tracking this?

@simonrl
Copy link

simonrl commented Aug 21, 2018

Hi, it seems to me that the above mentioned fix by @klimart does only work with products and categories that have the same URL key in both stores.
Did anyone get it working with different url keys?

Update

Maybe worth noting:
Magento\Store\Block\Switcher::getTargetStorePostData()
changing getCurrentUrl(false) to getCurrentUrl(true) did the trick for me and now adds nice rewritten URLs to the language switcher. The patch above is not required for this solution. One problem may be that it adds "___from_store=xx" to catalogsearch-URLs, presumably because they don't have a rewrite. Magento v 2.1.14

@PieterCappelle
Copy link
Contributor

Hi, has this been backported to 2.1 already?

@ste88
Copy link

ste88 commented Nov 28, 2018

Hi, I've created a backport for magento 2.1
Patch-Magento_Catalog-MAGETWO-83549-11963-Magento-2.1-language-switching.patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

No branches or pull requests