Or use your account on OC-Extensions


Forgot your password?

Or register your new account on OC-Extensions



Lost your password? Please enter your email address and will send you a new password.

Back to log-in


You're attempting to log into OC-Extensions from unrecognized IP Address. Please enter the Authentification Token that was sent to the email associated with this account.

No Authentification Token received?

How to move out of stock products at the end of results list

How to move out of stock products at the end of results list

Since we started to provide TTFB and CRO optimization services, we saw a lot of stores with all kind of issue.
Many of them are easy to fix, but store owners decide to ignore or maybe they are too busy.
Here's one of this issues: showing out of stock products at the top of category page.

Can you see what's wrong in image below?

There's a single product in stock and is at the end of the list.
80% of customers will not even scroll to the bottom.

Now, i'm sure you understand how you lose customers by NOT moving out of stock product at the END of list.

So, let's see how to to move out of stock product to the end of results
- open catalog/model/catalog/product.php
- search area marked in image below

- now make this changes (see image)

* with red = remove;
* with green = was added

Your final code will look like below:

If you want to apply this ONLY for default sort case, do change marked below instead of all changes described above

Some custom themes use a custom made controller to get products. Idea is the same but file location can be other.

If you use Journal, file and location is different: catalog/model/journal3/filter.php
Make changes according to image below:

DO NOT forget to rebuild OCMOD cache and to clear page cache (if you use any page cache extensions)
OCX Team

Since 2010 we exclusively focused on OpenCart platform. We know it from A to Z, being able to resolve any challenge might raise concerning the development of your ecommerce store.