0

I enabled Category permission from System->Configuration->Catalog->Category permission

When I searched for product on front end, it was showing bunch of products but the toolbar was showing wrong count (i.e. 1 Items(s)).

When I looked into code I found that, value of "disable_root_category_filter" is true for search page and for category landing pages, it's value is false.

Is there any way to solve this issue?

Ankita P.
  • 478
  • 10
  • 21

1 Answers1

0

Below code worked for me.

public function getSelectCountSql()
{   
    $this->_renderFilters();
    $countSelect = clone $this->getSelect();
    $countSelect->reset(Zend_Db_Select::ORDER);
    $countSelect->reset(Zend_Db_Select::LIMIT_COUNT);
    $countSelect->reset(Zend_Db_Select::LIMIT_OFFSET);
    $countSelect->reset(Zend_Db_Select::COLUMNS);

    // when count returns multiple rows
    if(count($this->getSelect()->getPart(Zend_Db_Select::GROUP)) > 0) {
        $countSelect->reset(Zend_Db_Select::GROUP);
        $countSelect->distinct(true);
        $group = $this->getSelect()->getPart(Zend_Db_Select::GROUP);
        $countSelect->columns("COUNT(DISTINCT ".implode(", ", $group).")");
    } else {
        $countSelect->columns('COUNT(*)');
    }
    return $countSelect;
}
Ankita P.
  • 478
  • 10
  • 21