Skip to content

Commit 4203b6c

Browse files
committed
Fixing table name if prefix available
1 parent ef8eea9 commit 4203b6c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,14 @@ private function getProductsCountFromCategoryTable(Category $item, string $websi
567567
*/
568568
private function getProductsCountQuery(array $categoryIds, $addVisibilityFilter = true): Select
569569
{
570-
$categoryTable = $this->_resource->getTableName('catalog_category_product_index');
570+
$connections = $this->_resource->getConnection();
571+
$categoryTable = $connections->getTableName('catalog_category_product_index');
572+
573+
$tablePrefix = $this->_resource->getTablePrefix();
574+
if ($tablePrefix && strpos($categoryTable, $tablePrefix) !== 0) {
575+
$categoryTable = $tablePrefix . $categoryTable;
576+
}
577+
571578
$select = $this->_conn->select()
572579
->from(
573580
['cat_index' => $categoryTable],

0 commit comments

Comments
 (0)