File tree 1 file changed +10
-2
lines changed
app/code/Magento/Store/Url/Plugin
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,8 @@ public function __construct(
52
52
* @param callable $proceed
53
53
* @param array $data
54
54
* @param bool $unsetOldParams
55
+ * @throws \Magento\Framework\Exception\NoSuchEntityException
56
+ *
55
57
* @return \Magento\Framework\Url\RouteParamsResolver
56
58
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
57
59
*/
@@ -66,13 +68,19 @@ public function aroundSetRouteParams(
66
68
unset($ data ['_scope ' ]);
67
69
}
68
70
if (isset ($ data ['_scope_to_url ' ]) && (bool )$ data ['_scope_to_url ' ] === true ) {
69
- $ storeCode = $ subject ->getScope () ?: $ this ->storeManager ->getStore ()->getCode ();
71
+ /** @var Store $currentScope */
72
+ $ currentScope = $ subject ->getScope ();
73
+ $ storeCode = $ currentScope && $ currentScope instanceof Store ?
74
+ $ currentScope ->getCode () :
75
+ $ this ->storeManager ->getStore ()->getCode ();
76
+
70
77
$ useStoreInUrl = $ this ->scopeConfig ->getValue (
71
78
Store::XML_PATH_STORE_IN_URL ,
72
79
StoreScopeInterface::SCOPE_STORE ,
73
80
$ storeCode
74
81
);
75
- if (!$ useStoreInUrl && !$ this ->storeManager ->hasSingleStore ()) {
82
+
83
+ if ($ useStoreInUrl && !$ this ->storeManager ->hasSingleStore ()) {
76
84
$ this ->queryParamsResolver ->setQueryParam ('___store ' , $ storeCode );
77
85
}
78
86
}
You can’t perform that action at this time.
0 commit comments