Skip to content

Commit 520e8ab

Browse files
magento/magento2-login-as-customer#58: If multiple stores exist under a specific website, user is logged into the default website for that store - pop-up options update.
1 parent b532d4e commit 520e8ab

File tree

1 file changed

+8
-6
lines changed
  • app/code/Magento/LoginAsCustomerAdminUi/Ui/Customer/Component/ConfirmationPopup

1 file changed

+8
-6
lines changed

app/code/Magento/LoginAsCustomerAdminUi/Ui/Customer/Component/ConfirmationPopup/Options.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,10 @@ private function generateCurrentOptions(int $customerId): array
124124
foreach ($websiteCollection as $website) {
125125
$groups = $this->fillStoreGroupOptions($website, $customer);
126126
if (!empty($groups)) {
127+
$code = $website->getCode();
127128
$name = $this->sanitizeName($website->getName());
128-
$options[$name]['label'] = $name;
129-
$options[$name]['value'] = array_values($groups);
129+
$options[$code]['label'] = $name;
130+
$options[$code]['value'] = $groups;
130131
}
131132
}
132133
}
@@ -154,11 +155,12 @@ private function fillStoreGroupOptions(Website $website, CustomerInterface $cust
154155
if ($group->getWebsiteId() == $websiteId) {
155156
$storeViewIds = $group->getStoreIds();
156157
if (!empty($storeViewIds)) {
158+
$code = $group->getCode();
157159
$name = $this->sanitizeName($group->getName());
158-
$groups[$name]['label'] = str_repeat(' ', 4) . $name;
159-
$groups[$name]['value'] = array_values($storeViewIds)[0];
160-
$groups[$name]['disabled'] = !$isGlobalScope && $customerWebsiteId !== $websiteId;
161-
$groups[$name]['selected'] = in_array($customerStoreId, $storeViewIds) ? true : false;
160+
$groups[$code]['label'] = str_repeat(' ', 4) . $name;
161+
$groups[$code]['value'] = array_values($storeViewIds)[0];
162+
$groups[$code]['disabled'] = !$isGlobalScope && $customerWebsiteId !== $websiteId;
163+
$groups[$code]['selected'] = in_array($customerStoreId, $storeViewIds) ? true : false;
162164
}
163165
}
164166
}

0 commit comments

Comments
 (0)