B-219 Sec-55 Noida, India
+918010221733

How to show out of stock products to the end of the product list in Magento

First of all overwrite the file

app/code/core/Mage/Catalog/Model/Layer.php

and copy this file to

app/code/local/Mage/Catalog/Model/Layer.php

In function getProductCollection(), Put this code after line #102

<?php
$collection->joinField(‘inventory_in_stock’, ‘cataloginventory_stock_item’, ‘is_in_stock’, ‘product_id=entity_id’,’is_in_stock>=0′, ‘left’)->setOrder(‘inventory_in_stock’, ‘desc’);
?>

(Visited 30 times, 1 visits today)

Leave a reply

You must be logged in to post a comment.