The product list pages are currently set to show out of stock products. I would like to show these products after the In Stock items. Thanks.

1 Answer 1


You can use catalog_product_collection_load_before event.

And in the observer:

public function modifyProductCollection(Varien_Event_Observer $observer) {
    $collection = $observer->getCollection();

                array('_inventory_table' => $collection->getTable('cataloginventory/stock_item')),
                "_inventory_table.product_id = e.entity_id",
            ->order('is_in_stock DESC')
            ->order('created_at DESC');

Note: Tested on, I guess it will work on 1.8, too.

  • The disadvantage to this approach is that not all out of stock products will be in the correct position as the is_in_stock entry doesn't take isSalable in account. Dec 5, 2013 at 12:56
  • Sorry, I'm still learning how all of this works. Where do I need to make these changes?
    – bezz
    Dec 5, 2013 at 14:27
  • You will need a new module for this. Search on the net for creating module with observer, there are many tutorials.
    – enenen
    Dec 6, 2013 at 8:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.