We have installed a extension for the Layered Navigation. Here we need to modify the logic for the product count.

We have already written code for the getting the count by overriding the the following page.


public function getCount($filter)
    // clone select from collection with filters
    $select = clone $filter->getLayer()->getProductCollection()
                ->addAttributeToFilter('num_of_child',array('gt' => 0))
    // reset columns, order and limitation conditions

    $connection = $this->_getReadAdapter();
    $attribute  = $filter->getAttributeModel();
    $tableAlias = sprintf('%s_idx', $attribute->getAttributeCode());
    $conditions = array(
        "{$tableAlias}.entity_id = e.entity_id",
        $connection->quoteInto("{$tableAlias}.attribute_id = ?", $attribute->getAttributeId()),
        $connection->quoteInto("{$tableAlias}.store_id = ?", $filter->getStoreId()),

            array($tableAlias => $this->getMainTable()),
            join(' AND ', $conditions),
            array('value', 'count' => new Zend_Db_Expr("COUNT({$tableAlias}.entity_id)")))

    return $connection->fetchPairs($select);

This seems to be working while loading the page initially. However if user clicks in one of the filter, the logic in above page is not working instead its getting the count from some other function. It would be really helpful if someone could tell where is the logic for Selected Filter In Layered Navigation is located so that we can modify it.

1 Answer 1


you can go to this file


and check _getItemsData function.

  • This is not a common reference file.
    – benmarks
    Jun 6, 2016 at 10:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.