-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Calling getCurrentUrl on Store will wrongly add "___store" parameter #18941
Comments
Hi @LucaGallinari. Thank you for your report.
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
where @LucaGallinari do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?
|
Hi @engcom-backlog-nazar. Thank you for working on this issue.
|
@engcom-backlog-nazar Thank you for verifying the issue. Based on the provided information internal tickets |
#mm18nyc please give me access to the issue |
Hi @Eudemon. Thank you for working on this issue.
|
Hi @Nazar65. Thank you for working on this issue.
|
I can confirm both the issue and the analysis. The bug has been introduced in Magento 2.2.6 by this commit 1115b3f#diff-4fbd3d4201dcd6192396c81a56a4a850 Actually I see no reason why the exclamation mark had to be removed: there is no reason why you should have the ___store parameter set when you have the "use store code in urls" set to yes. |
Hi @LucaGallinari. Thank you for your report.
The fix will be available with the upcoming 2.3.1 release. |
Hi @LucaGallinari. Thank you for your report. The fix will be available with the upcoming 2.2.8 release. |
Will this issue be fixed in 2.1.x? This is a pretty serious issue. |
Summary (*)
I have the config "store code in URL" set to "yes" but when i use the method "getCurrentUrl" on a Store type variable i get the current URL but with the parameter "___store=[code]" in it, if the current store is not the one requested in the URL.
I want to use the getCurrentUrl method in order to redirect the user to the correct store based on some custom logic (like the browser language), but i don't want any additional parameters to be in the URL.
Form what i found out by looking around in the code, the parameter "___store" is mandatory when the config "use store code in URL" is set to "no" but not when it's set to "yes", as in my case. The store code is already in the URL (as set in system config) and it's not necessary to add any other parameters in the URL to remark this.
Examples (*)
Proposed solution
Not a solution but this is what i found out by debugging.
At this line of code you can clearly see that it's applying the right logic. But if you try to debug you'll see that at this point of the code the variable $storeUrl has already the parameter "___store" set in it, because it's in this line that it do this. By going to the getUrl method implementation you'll found out that if the current store is not the one requested in the URL it'll add the "_scope_to_url" param at this line. This flag will eventually cause the problem because it will end up at this line where i think the wrong logic is applied, it's the opposite as the one that i pointed out initially in this section.
The text was updated successfully, but these errors were encountered: