Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Magento 如何在列表页面中筛选零价格产品_Magento - Fatal编程技术网

Magento 如何在列表页面中筛选零价格产品

Magento 如何在列表页面中筛选零价格产品,magento,Magento,我使用了排序方式->setOrder('price','desc'); 但是在这种情况下,当我们按名称对产品进行排序时,它不能很好地工作 有没有办法按价格(从低到大)排序,这样零价格的产品就可以排在清单的末尾了 公共函数集合($collection) { $this->_collection=$collection $this->_collection->setCurPage($this->getCurrentPage()); // we need to se

我使用了排序方式->setOrder('price','desc'); 但是在这种情况下,当我们按名称对产品进行排序时,它不能很好地工作

有没有办法按价格(从低到大)排序,这样零价格的产品就可以排在清单的末尾了

公共函数集合($collection) { $this->_collection=$collection

    $this->_collection->setCurPage($this->getCurrentPage());

    // we need to set pagination only if passed value integer and more that 0
    $limit = (int)$this->getLimit();
    if ($limit) {
        $this->_collection->setPageSize($limit);
    }
    if ($this->getCurrentOrder()) {
       $this->_collection->setOrder($this->getCurrentOrder(), $this->getCurrentDirection())
             ->setOrder('price','desc');
    }
    return $this;
}

这个问题不是很清楚,但据我所知: (价格排序)默认情况下,Magento在产品列表页面中提供此功能。 也许您已经更改了@backend的价格属性

检查价格属性。 用于产品列表=是 用于产品列表中的排序=是


清除缓存,您就可以开始了。

否,它将只显示范围为0到1000的产品,但我想在这里显示所有产品正常排序工作正常(从低到高或从高到低)但是,如果您真的希望能够在最后包含零价格产品,那么如何列出它的示例是:产品1:3产品2:18产品3:0产品4:0然后创建两个产品集合。1表示大于0,然后其他表示0。然后独立排序,并合并在展览前收集。