File tree Expand file tree Collapse file tree 1 file changed +18
-13
lines changed Expand file tree Collapse file tree 1 file changed +18
-13
lines changed Original file line number Diff line number Diff line change @@ -6,18 +6,18 @@ class HideDefaultStoreCode
66{
77 /**
88 *
9- * @var \Noon\HideDefaultStoreCode\Helper\Data
9+ * @var \Noon\HideDefaultStoreCode\Helper\Data
1010 */
1111 protected $ helper ;
12-
12+
1313 /**
1414 *
1515 * @var \Magento\Store\Model\StoreManagerInterface
1616 */
1717 protected $ storeManager ;
18-
18+
1919 /**
20- *
20+ *
2121 * @param \Noon\HideDefaultStoreCode\Helper\Data $helper
2222 * @param \Magento\Store\Model\StoreManagerInterface $storeManager
2323 */
@@ -30,16 +30,21 @@ public function __construct(
3030 }
3131
3232 /**
33- *
33+ *
3434 * @param \Magento\Store\Model\Store $subject
3535 * @param string $url
3636 * @return string
3737 */
38- public function afterGetBaseUrl (\Magento \Store \Model \Store $ subject , $ url )
39- {
40- if ($ this ->helper ->isHideDefaultStoreCode () && !is_null ($ this ->storeManager ->getDefaultStoreView ())) {
41- $ url = str_replace ('/ ' .$ this ->storeManager ->getDefaultStoreView ()->getCode ().'/ ' , '/ ' , $ url );
42- }
43- return $ url ;
44- }
45- }
38+ public function afterGetBaseUrl (\Magento \Store \Model \Store $ subject , $ url )
39+ {
40+ $ websiteId = $ this ->storeManager ->getStore ()->getWebsiteId ();
41+ $ defaultStore = $ this ->storeManager ->getWebsite ($ websiteId )->getDefaultStore ();
42+ if (
43+ $ this ->helper ->isHideDefaultStoreCode ()
44+ && !is_null ($ defaultStore )
45+ ) {
46+ $ url = str_replace ('/ ' .$ defaultStore ->getCode ().'/ ' , '/ ' , $ url );
47+ }
48+ return $ url ;
49+ }
50+ }
You can’t perform that action at this time.
0 commit comments