Automatically hide out of stock products in opencart 1.5.6

Posted by Flo on 10 Sep 2013

For out of stock products you can use stock statuses to inform customer that you had that product in stock but you dont anymore, however some merchants would preffer to not display at all the products they dont have in stock, if you wish to do that, here is a simple modification you can do to obtain it.

Edit the file catalog/model/catalog/product.php and inside it seach for the code:

pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1'

You will find it 3 times, and each time replace it with the code:

pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.quantity > '0'

Then save the file and done, your out of stock products will not display anymore.

If you use vqmod and do not wish to edit your core file just download this vqmod from here , drop the xml file from the archive in your store's vqmod/xml folder and you obtained the modification even faster.