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 @@ -51,6 +51,8 @@ public function __construct(
51
51
* @param \Magento\Framework\Url\RouteParamsResolver $subject
52
52
* @param array $data
53
53
* @param bool $unsetOldParams
54
+ * @throws \Magento\Framework\Exception\NoSuchEntityException
55
+ *
54
56
* @return array
55
57
*/
56
58
public function beforeSetRouteParams (
@@ -63,13 +65,19 @@ public function beforeSetRouteParams(
63
65
unset($ data ['_scope ' ]);
64
66
}
65
67
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
+
67
74
$ useStoreInUrl = $ this ->scopeConfig ->getValue (
68
75
Store::XML_PATH_STORE_IN_URL ,
69
76
StoreScopeInterface::SCOPE_STORE ,
70
77
$ storeCode
71
78
);
72
- if (!$ useStoreInUrl && !$ this ->storeManager ->hasSingleStore ()) {
79
+
80
+ if ($ useStoreInUrl && !$ this ->storeManager ->hasSingleStore ()) {
73
81
$ this ->queryParamsResolver ->setQueryParam ('___store ' , $ storeCode );
74
82
}
75
83
}
You can’t perform that action at this time.
0 commit comments