Magento:在类别页面中显示最后的缺货产品(Magento : Out of stock products showing last in the category page)
我正在使用Magento 1.7.0.2,我在/app/code/core/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');在排序位置和名称时,缺货产品是最后的。 但是在对价格进行分类时,缺货产品处于正常状态并且不会持久。
我怎样才能让缺货产品即使在价格之后仍然是最后的?
I am using Magento 1.7.0.2 and I have this code line that i am using in /app/code/core/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');When sorting for position and name the out of stock products are last. But when sorting for price, the out of stock products are in a normal order not last.
How can i make that the out of stock products to be last even in the sort after price ?
更多推荐
发布评论