Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions app/code/core/Mage/Catalog/Model/Resource/Category/Flat.php
Original file line number Diff line number Diff line change
Expand Up @@ -1233,19 +1233,15 @@ public function getChildrenAmount($category, $isActiveFlag = true)

/**
* Get products count in category
*
* @param Mage_Catalog_Model_Category $category
* @return int
*/
public function getProductCount($category)
public function getProductCount(Mage_Catalog_Model_Category $category): int
{
$select = $this->_getReadAdapter()->select()
->from(
$this->getTable('catalog/category_product'),
"COUNT({$this->getTable('catalog/category_product')}.product_id)",
)
->where("{$this->getTable('catalog/category_product')}.category_id = ?", $category->getId())
->group("{$this->getTable('catalog/category_product')}.category_id");
->where("{$this->getTable('catalog/category_product')}.category_id = ?", $category->getId());
return (int) $this->_getReadAdapter()->fetchOne($select);
}

Expand Down
Loading