Skip to content

Commit 0faaa16

Browse files
committed
ACP2E-3389: Adobe Commerce backend loads categories very slowly
1 parent b2dd08c commit 0faaa16

File tree

1 file changed

+0
-39
lines changed

1 file changed

+0
-39
lines changed

app/code/Magento/Catalog/Model/ResourceModel/Category/Collection.php

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -566,45 +566,6 @@ public function getProductTable()
566566
return $this->_productTable;
567567
}
568568

569-
/**
570-
* Get products count using catalog_category_entity table
571-
*
572-
* @param Category $item
573-
* @param string $websiteId
574-
* @return int
575-
*/
576-
private function getProductsCountFromCategoryTable(Category $item, string $websiteId): int
577-
{
578-
$productCount = 0;
579-
580-
if ($item->getAllChildren()) {
581-
$bind = ['entity_id' => $item->getId(), 'c_path' => $item->getPath() . '/%'];
582-
$select = $this->_conn->select();
583-
$select->from(
584-
['main_table' => $this->getProductTable()],
585-
new \Zend_Db_Expr('COUNT(DISTINCT main_table.product_id)')
586-
)->joinInner(
587-
['e' => $this->getTable('catalog_category_entity')],
588-
'main_table.category_id=e.entity_id',
589-
[]
590-
)->where(
591-
'(e.entity_id = :entity_id OR e.path LIKE :c_path)'
592-
);
593-
if ($websiteId) {
594-
$select->join(
595-
['w' => $this->getProductWebsiteTable()],
596-
'main_table.product_id = w.product_id',
597-
[]
598-
)->where(
599-
'w.website_id = ?',
600-
$websiteId
601-
);
602-
}
603-
$productCount = (int)$this->_conn->fetchOne($select, $bind);
604-
}
605-
return $productCount;
606-
}
607-
608569
/**
609570
* Get query for retrieve count of products per category
610571
*

0 commit comments

Comments
 (0)