cancel
Showing results for 
Search instead for 
Did you mean: 

Out of stock last for tags page

Out of stock last for tags page

 Hi,

I want to push all out of stock products at the end of list. I did it for Category List and Category Search Page. What i could not do is to do it for tags page.

For future reference and those who want to do the same i bring my method here:

For Category List i tweaked the \app\code\core\Mage\Catalog\Model\Layer.php file and add this code to getProductCollection() method after $collection = $this->getCurrentCategory()->getProductCollection();

 

$collection->joinFieldCa('inventory_in_stock', 'cataloginventory_stock_item', 'is_in_stock', 'product_id=entity_id','is_in_stock>=0', 'left')->setOrder('inventory_in_stock', 'desc');

For Category Search page i tweaked the the \app\code\local\Smartwave\Ajaxcatalog\Model\Catalog\Layer.php and add the same code to getProductCollection() method after $collection = Mage::getResourceModel('catalogsearch/fulltext_collection');

$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');

So, any idea on how should i do this for tags page?