File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
app/code/Magento/Store/App/Action/Plugin Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change 11
11
use Magento \Framework \Exception \NotFoundException ;
12
12
use Magento \Store \Api \Data \StoreInterface ;
13
13
use Magento \Store \Api \StoreCookieManagerInterface ;
14
+ use Magento \Store \Model \Store ;
14
15
use Magento \Store \Model \StoreManagerInterface ;
15
16
use Magento \Framework \App \Action \AbstractAction ;
16
17
use Magento \Framework \App \RequestInterface ;
@@ -127,14 +128,19 @@ private function processInvalidStoreRequested(
127
128
*
128
129
* @param StoreInterface $store
129
130
* @return void
131
+ * @throws \Magento\Framework\Exception\LocalizedException
130
132
*/
131
133
private function updateContext (StoreInterface $ store )
132
134
{
133
- $ this ->httpContext ->setValue (
134
- StoreManagerInterface::CONTEXT_STORE ,
135
- $ store ->getCode (),
136
- $ this ->storeManager ->getDefaultStoreView ()->getCode ()
137
- );
135
+ if (!$ store ->getConfig (Store::XML_PATH_STORE_IN_URL ) ||
136
+ $ store ->getId () == $ this ->storeManager ->getDefaultStoreView ()->getId ()
137
+ ) {
138
+ $ this ->httpContext ->setValue (
139
+ StoreManagerInterface::CONTEXT_STORE ,
140
+ $ store ->getCode (),
141
+ $ this ->storeManager ->getDefaultStoreView ()->getCode ()
142
+ );
143
+ }
138
144
139
145
/** @var StoreInterface $defaultStore */
140
146
$ defaultStore = $ this ->storeManager ->getWebsite ()->getDefaultStore ();
You can’t perform that action at this time.
0 commit comments