Page 1 of 1
How can I hide out of stock items?
Posted: Fri Apr 21, 2023 10:56 pm
by IT-Me-Up.co.uk
Hi,
I have recently migrated my store to v4 and some functions that I had codes into v3 are not working.
The main priority for me right now is to hide any products which have the stock count as 0.
Does any one know where this query is stored and how I can correctly update it?
Before I added a line of code to the product.php file to hide out of stock items.
Thank you
IT-Me-Up
Re: How can I hide out of stock items?
Posted: Sat Apr 22, 2023 3:33 am
by straightlight
IT-Me-Up.co.uk wrote: ↑Fri Apr 21, 2023 10:56 pm
Hi,
I have recently migrated my store to v4 and some functions that I had codes into v3 are not working.
The main priority for me right now is to hide any products which have the stock count as 0.
Does any one know where this query is stored and how I can correctly update it?
Before I added a line of code to the product.php file to hide out of stock items.
Thank you
IT-Me-Up
OC version.
Re: How can I hide out of stock items?
Posted: Sat Apr 22, 2023 10:38 pm
by grgr
First, why? Affects search engines.
Otherwise, for the category it is the getproducts() function in ../catalog/model/catalog/product.php file.
Find
and after add
That should in theory work, though I supply no guarantee as that is from memory.
Re: How can I hide out of stock items?
Posted: Tue May 02, 2023 7:51 pm
by IT-Me-Up.co.uk
straightlight wrote: ↑Sat Apr 22, 2023 3:33 am
IT-Me-Up.co.uk wrote: ↑Fri Apr 21, 2023 10:56 pm
Hi,
I have recently migrated my store to v4 and some functions that I had codes into v3 are not working.
The main priority for me right now is to hide any products which have the stock count as 0.
Does any one know where this query is stored and how I can correctly update it?
Before I added a line of code to the product.php file to hide out of stock items.
Thank you
IT-Me-Up
OC version.
Version 4.0.1.1
Re: How can I hide out of stock items?
Posted: Tue May 02, 2023 8:05 pm
by IT-Me-Up.co.uk
grgr wrote: ↑Sat Apr 22, 2023 10:38 pm
First, why? Affects search engines.
Otherwise, for the category it is the getproducts() function in ../catalog/model/catalog/product.php file.
Find
and after add
That should in theory work, though I supply no guarantee as that is from memory.
Thank you, this works to some extent.
The category menu still shows 4 items (for example) when only 2 are availible but at least the out of stock items are no longer showing.
I pull my products from my supplier via an XML feed.
As they are not in stock with my supplier, I do not want to list them on my site.
Re: How can I hide out of stock items?
Posted: Tue May 02, 2023 8:14 pm
by straightlight
IT-Me-Up.co.uk wrote: ↑Tue May 02, 2023 8:05 pm
grgr wrote: ↑Sat Apr 22, 2023 10:38 pm
First, why? Affects search engines.
Otherwise, for the category it is the getproducts() function in ../catalog/model/catalog/product.php file.
Find
and after add
That should in theory work, though I supply no guarantee as that is from memory.
Thank you, this works to some extent.
The category menu still shows 4 items (for example) when only 2 are availible but at least the out of stock items are no longer showing.
I pull my products from my supplier via an XML feed.
As they are not in stock with my supplier, I do not want to list them on my site.
Since your inquiry is about a feed media, this could be done directly from your extension. If you have either downloaded or purchased an extension from another extension developer or on the Marketplace, contact the extension developer or create a new service request in the Commercial Support section of the forum to get this done as a custom job.