pozpoz Posted April 24, 2024 Share Posted April 24, 2024 I am trying to hide out of stock products from Catalog and Search but leave accesible via URL. How to do it? Are there modules for it? Tried to modify search controller but in search I lost paging (not all product showed). Any tips? Link to comment Share on other sites More sharing options...
AddWeb Solution Posted April 25, 2024 Share Posted April 25, 2024 Hi, 9 hours ago, pozpoz said: hide out of stock products from Catalog In your Prestashop admin panel, go to Catalog > Products and filter products by "Out of stoc." Then, edit each product and change its visibility to "Nowhere." This will hide the products from catalog listings and search results. 9 hours ago, pozpoz said: Tried to modify search controller but in search I lost paging (not all product showed) Instead of directly modifying the core controllers, you should override them in your custom module or theme. This allows you to maintain the original functionality while adding your custom logic. Override the templates responsible for displaying product listings in your theme. Here, you can add logic to check if the product is out of stock and conditionally display it. This way, the products will still be accessible via direct URL but won't appear in search results or catalog listings. When overriding controllers or templates, make sure to handle pagination correctly to avoid issues like missing products or incorrect page counts. Thoroughly test your changes to ensure that hiding out-of-stock products doesn't break any existing functionality and that products remain accessible via URL. Hope this would help. Thanks! Link to comment Share on other sites More sharing options...
Prestashop Addict Posted April 27, 2024 Share Posted April 27, 2024 (edited) @AddWeb Solution is working, but you need to change it when updating stock 😞 It could be better maybe to modify miniature product template and do not display if out of stock with a simple {if } Edited April 27, 2024 by Prestashop Addict (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now