forked from ConvertGroupsAS/magento2-patches
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Patch-Magento_Catalog-improve-root-category-indexer-2.2.8-v2.patch
45 lines (44 loc) · 1.52 KB
/
Patch-Magento_Catalog-improve-root-category-indexer-2.2.8-v2.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
--- Model/Indexer/Category/Product/AbstractAction.php 2019-07-09 14:57:01.280954957 +0300
+++ Model/Indexer/Category/Product/AbstractAction.php 2019-07-09 14:56:04.000000000 +0300
@@ -174,9 +174,9 @@
foreach ($this->storeManager->getStores() as $store) {
if ($this->getPathFromCategoryId($store->getRootCategoryId())) {
$this->currentStoreId = $store->getId();
- $this->reindexRootCategory($store);
$this->reindexAnchorCategories($store);
$this->reindexNonAnchorCategories($store);
+ $this->reindexRootCategory($store);
}
}
}
@@ -860,8 +860,11 @@
protected function reindexRootCategory(Store $store)
{
if ($this->isIndexRootCategoryNeeded()) {
+ $productSelect = $this->getAllProducts($store)->where(
+ 'ccp.category_id = ' . $store->getRootCategoryId()
+ );
$selects = $this->prepareSelectsByRange(
- $this->getAllProducts($store),
+ $productSelect,
'entity_id',
self::RANGE_PRODUCT_STEP
);
--- Model/Indexer/Category/Product/Action/Full.php
+++ Model/Indexer/Category/Product/Action/Full.php
@@ -272,4 +272,15 @@
$this->publishData($store);
}
}
+
+ /**
+ * Check whether indexation of root category is needed
+ *
+ * @return bool
+ */
+ protected function isIndexRootCategoryNeeded()
+ {
+ return false;
+ }
}
+