【问题标题】:Category permission affecting Catalog Search on frontend影响前端目录搜索的类别权限
【发布时间】:2014-02-27 17:24:09
【问题描述】:

我从System->Configuration->Catalog->Category permission

启用了Category permission

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

当我查看代码时,我发现“disable_root_category_filter”的值为搜索页面和类别登录页面的true,其值为false。

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

【问题讨论】:

    标签: magento magento-1.13


    【解决方案1】:

    以下代码对我有用。

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

    【讨论】:

      猜你喜欢
      • 2021-02-14
      • 2015-03-30
      • 2012-09-10
      • 1970-01-01
      • 2015-04-25
      • 1970-01-01
      • 2023-02-09
      • 2016-08-20
      • 1970-01-01
      相关资源
      最近更新 更多