File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
app/code/Magento/Store/Model Expand file tree Collapse file tree 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)
11661166 if (!$ this ->isUseStoreInUrl ()) {
11671167 $ storeParsedQuery ['___store ' ] = $ this ->getCode ();
11681168 }
1169+ if ($ this ->getCode () !== $ this ->_storeManager ->getStore ()->getCode ()) {
1170+ $ fromStore = true ;
1171+ }
11691172 if ($ fromStore !== false ) {
11701173 $ storeParsedQuery ['___from_store ' ] = $ fromStore ===
11711174 true ? $ this ->_storeManager ->getStore ()->getCode () : $ fromStore ;
@@ -1175,9 +1178,14 @@ public function getCurrentUrl($fromStore = true)
11751178 . ':// '
11761179 . $ storeParsedUrl ['host ' ]
11771180 . (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 , '' , '& ' ) : '' );
11811189
11821190 return $ currentUrl ;
11831191 }
You can’t perform that action at this time.
0 commit comments