【发布时间】:2014-09-10 04:28:33
【问题描述】:
我正在使用 Magento 1.9,并且我在 /app/code/local/Mage/Catalog/Block/Product/List.php 中使用了此代码行:
$this->_productCollection = $layer->getProductCollection()
->joinField(
'inventory_in_stock',
'cataloginventory_stock_item',
'is_in_stock',
'product_id=entity_id',
'is_in_stock>=0',
'left')
->setOrder('inventory_in_stock','desc');
但什么也没发生。
有人可以帮助我吗? 提前致谢!
【问题讨论】:
-
尝试
addAttributeToSort('inventory_in_stock', 'desc');而不是setOrder -
还是不行。
标签: magento