We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 03f436f + 349fd4b commit fa80010Copy full SHA for fa80010
app/code/Magento/Catalog/Controller/Adminhtml/Category/Edit.php
@@ -59,7 +59,16 @@ public function execute()
59
if ($storeId) {
60
$categoryId = (int)$this->storeManager->getStore($storeId)->getRootCategoryId();
61
} else {
62
- $categoryId = (int)$this->storeManager->getDefaultStoreView()->getRootCategoryId();
+ $defaultStoreView = $this->storeManager->getDefaultStoreView();
63
+ if ($defaultStoreView) {
64
+ $categoryId = (int)$defaultStoreView->getRootCategoryId();
65
+ } else {
66
+ $stores = $this->storeManager->getStores();
67
+ if (count($stores)) {
68
+ $store = reset($stores);
69
+ $categoryId = (int)$store->getRootCategoryId();
70
+ }
71
72
}
73
$this->getRequest()->setParam('id', $categoryId);
74
0 commit comments