How to Show Out Of Stock Products at the end of product list

Hello Friends, If you want to display the Out of Stock product at the end of the product list Then go to following manner:

1. First go to app/code/core/Mage/catelog/Block/product/list.php

2. then find the function _getProductCollection().

3. then find the following line
<?php
$this->_productCollection = $layer->getProductCollection();
?>

modified this line, this following way
<?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');
?>

4. See your product listing page.

Thanks,
Pritesh Pritesh

Pritesh Pethani

Request a Quote!!

Share your concept and we will return to you within 24 hours. Let us work out the best software solution for you!

Let's Start
Whatspp