0

在 magento 中,我们可以按价格对目录进行排序。我有一些价格为零的产品(这意味着我们回电给客户或客户打电话给我们与我们核对价格)

有没有办法按价格(从低到大)排序,零价格的产品将在列表的末尾???

我认为对于这样的解决方案,我必须在产品集合模型中添加一些额外的条件,并将这个零价格项目加入到集合的末尾,但我不知道该怎么做。

可能有人知道如何,或者知道另一种解决方案

谢谢

4

1 回答 1

0

转到 Mage_Catalog_Model_Category 和 262 行附近,功能:getProductCollection 将代码修改为类似的内容:

public function getProductCollection()
{
    $collection = Mage::getResourceModel('catalog/product_collection')
        ->setStoreId($this->getStoreId())
        ->addCategoryFilter($this)
        ->addAttributeToSort('price', 'desc');
    return $collection;
}

您可以在此网址http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/using_collections_in_magento gl上获得有关收藏的更多信息

于 2012-08-15T20:47:12.687 回答