Skip to content

Commit 5593c54

Browse files
author
Bohdan Berezhniy
committed
14008-use-default-stores-for-rule-validation
1 parent 1a4efd5 commit 5593c54

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

Model/ProductLabelAction.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -325,26 +325,24 @@ protected function isRuleWilBeAppliedForSpecificProduct(array $params): bool
325325
private function getDefaultStoreIds($rule): array
326326
{
327327
$defaultStoreIds = [];
328-
329328
$storeIds = (array)$rule->getStoreIds();
330329

331330
// [website_id => default_store_id]
332-
$websiteIdToDefaultStoreIdMap = $this->getWebsitesMap->execute();
331+
$websiteToDefaultStoreMap = $this->getWebsitesMap->execute();
333332

334333
if (in_array(0, $storeIds)) {
335-
$defaultStoreIds = $websiteIdToDefaultStoreIdMap;
334+
$defaultStoreIds = $websiteToDefaultStoreMap;
336335
} else {
337336
$storeManager = \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Store\Model\StoreManagerInterface::class);
338337

339338
foreach ($storeIds as $id) {
340-
341339
$websiteId = $storeManager->getStore($id)->getWebsiteId();
342340
$websiteIds[$websiteId] = $websiteId;
343341
}
344342

345343
foreach ($websiteIds as $websiteId) {
346-
if (isset($websiteIdToDefaultStoreIdMap[$websiteId])) {
347-
$defaultStoreIds[] = $websiteIdToDefaultStoreIdMap[$websiteId];
344+
if (isset($websiteToDefaultStoreMap[$websiteId])) {
345+
$defaultStoreIds[] = $websiteToDefaultStoreMap[$websiteId];
348346
}
349347
}
350348
}

0 commit comments

Comments
 (0)