Skip to content

Commit 741cd2b

Browse files
author
OlgaVasyltsun
committed
MC-19316: Reindex error when website have store without store view
1 parent 7eddafd commit 741cd2b

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
@@ -79,25 +79,30 @@ public function get()
7979
'scopes' => [],
8080
];
8181

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

0 commit comments

Comments
 (0)