Skip to content

Commit 60fc208

Browse files
author
OlgaVasyltsun
committed
MC-19334: Reindex error when website have store without store view
1 parent f488996 commit 60fc208

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

app/code/Magento/Store/Model/ScopeTreeProvider.php

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -78,25 +78,30 @@ public function get()
7878
'scopes' => [],
7979
];
8080

81-
/** @var Group $group */
82-
foreach ($groups[$website->getId()] as $group) {
83-
$groupScope = [
84-
'scope' => ScopeInterface::SCOPE_GROUP,
85-
'scope_id' => $group->getId(),
86-
'scopes' => [],
87-
];
88-
89-
/** @var Store $store */
90-
foreach ($stores[$group->getId()] as $store) {
91-
$storeScope = [
92-
'scope' => ScopeInterface::SCOPE_STORES,
93-
'scope_id' => $store->getId(),
81+
if (!empty($groups[$website->getId()])) {
82+
/** @var Group $group */
83+
foreach ($groups[$website->getId()] as $group) {
84+
$groupScope = [
85+
'scope' => ScopeInterface::SCOPE_GROUP,
86+
'scope_id' => $group->getId(),
9487
'scopes' => [],
9588
];
96-
$groupScope['scopes'][] = $storeScope;
89+
90+
if (!empty($stores[$group->getId()])) {
91+
/** @var Store $store */
92+
foreach ($stores[$group->getId()] as $store) {
93+
$storeScope = [
94+
'scope' => ScopeInterface::SCOPE_STORES,
95+
'scope_id' => $store->getId(),
96+
'scopes' => [],
97+
];
98+
$groupScope['scopes'][] = $storeScope;
99+
}
100+
}
101+
$websiteScope['scopes'][] = $groupScope;
97102
}
98-
$websiteScope['scopes'][] = $groupScope;
99103
}
104+
100105
$defaultScope['scopes'][] = $websiteScope;
101106
}
102107

0 commit comments

Comments
 (0)