影响前端目录搜索的类别权限

时间:2014-02-26 11:20:17

标签: magento magento-1.13

我从系统 - >配置 - >目录 - >类别权限

启用了类别权限

当我在前端搜索产品时,它显示了一堆产品,但工具栏显示错误计数(即 1个项目)。

当我查看代码时,我发现,对于搜索页面和类别着陆页,“ disable_root_category_filter ”的值为 true ,其值为 false < /强>

有没有办法解决这个问题?

1 个答案:

答案 0 :(得分:0)

下面的代码对我有用。

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;
}