I am using Magento 1.9 , to display out of stock products at the end of product list i have replaced the code
<?php
$this->_productCollection = $layer->getProductCollection();
?>
With
<?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');
?>
in app/code/core/Mage/catelog/Block/product/list.php now products 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 ?Please help me find out this solution.