File tree 1 file changed +11
-3
lines changed
app/code/Magento/Store/Model
1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -1166,6 +1166,9 @@ public function getCurrentUrl($fromStore = true)
1166
1166
if (!$ this ->isUseStoreInUrl ()) {
1167
1167
$ storeParsedQuery ['___store ' ] = $ this ->getCode ();
1168
1168
}
1169
+ if ($ this ->getCode () !== $ this ->_storeManager ->getStore ()->getCode ()) {
1170
+ $ fromStore = true ;
1171
+ }
1169
1172
if ($ fromStore !== false ) {
1170
1173
$ storeParsedQuery ['___from_store ' ] = $ fromStore ===
1171
1174
true ? $ this ->_storeManager ->getStore ()->getCode () : $ fromStore ;
@@ -1175,9 +1178,14 @@ public function getCurrentUrl($fromStore = true)
1175
1178
. ':// '
1176
1179
. $ storeParsedUrl ['host ' ]
1177
1180
. (isset ($ storeParsedUrl ['port ' ]) ? ': ' . $ storeParsedUrl ['port ' ] : '' )
1178
- . $ storeParsedUrl ['path ' ]
1179
- . $ requestString
1180
- . ($ storeParsedQuery ? '? ' . http_build_query ($ storeParsedQuery , '' , '& ' ) : '' );
1181
+ . $ storeParsedUrl ['path ' ];
1182
+
1183
+ //avoid query params duplication
1184
+ if (!preg_match ('/___store=(.*?)&___from_store=(.*?)/ ' , $ requestString )) {
1185
+ $ currentUrl .= $ requestString ;
1186
+ }
1187
+
1188
+ $ currentUrl .= ($ storeParsedQuery ? '? ' . http_build_query ($ storeParsedQuery , '' , '& ' ) : '' );
1181
1189
1182
1190
return $ currentUrl ;
1183
1191
}
You can’t perform that action at this time.
0 commit comments