Magento:在类别页面中显示最后的缺货产品(Magento : Out of stock products showing last in the category page)

编程入门 行业动态 更新时间:2024-10-22 08:07:11
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 ?

更多推荐

本文发布于:2023-04-29 08:54:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1335927.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:类别   页面   产品   Magento   stock

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!