File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
app/code/Magento/Store/Url/Plugin Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,8 @@ public function __construct(
5151 * @param \Magento\Framework\Url\RouteParamsResolver $subject
5252 * @param array $data
5353 * @param bool $unsetOldParams
54+ * @throws \Magento\Framework\Exception\NoSuchEntityException
55+ *
5456 * @return array
5557 */
5658 public function beforeSetRouteParams (
@@ -63,13 +65,19 @@ public function beforeSetRouteParams(
6365 unset($ data ['_scope ' ]);
6466 }
6567 if (isset ($ data ['_scope_to_url ' ]) && (bool )$ data ['_scope_to_url ' ] === true ) {
66- $ storeCode = $ subject ->getScope () ?: $ this ->storeManager ->getStore ()->getCode ();
68+ /** @var Store $currentScope */
69+ $ currentScope = $ subject ->getScope ();
70+ $ storeCode = $ currentScope && $ currentScope instanceof Store ?
71+ $ currentScope ->getCode () :
72+ $ this ->storeManager ->getStore ()->getCode ();
73+
6774 $ useStoreInUrl = $ this ->scopeConfig ->getValue (
6875 Store::XML_PATH_STORE_IN_URL ,
6976 StoreScopeInterface::SCOPE_STORE ,
7077 $ storeCode
7178 );
72- if (!$ useStoreInUrl && !$ this ->storeManager ->hasSingleStore ()) {
79+
80+ if ($ useStoreInUrl && !$ this ->storeManager ->hasSingleStore ()) {
7381 $ this ->queryParamsResolver ->setQueryParam ('___store ' , $ storeCode );
7482 }
7583 }
You can’t perform that action at this time.
0 commit comments