Mian Waqas Posted February 2 Share Posted February 2 Hi, This is just for information for anyone looking for this kind of change. If you have visibility of "Out of stock products" active in PS, and you want to hide the "out of stock products" in certain modules/hooks you can simply edit the tpl file of that module/hook like below. for example if you want to hide the out of stock products for "ps_categoryproducts" module edit > /modules/ps_categoryproducts/views/templates/hook/ps_categoryproducts.tpl file change this line {foreach from=$products item="product"} {include file="catalog/_partials/miniatures/product.tpl" product=$product} {/foreach} to this {assign var="displayedProducts" value=0} {while $displayedProducts < 4} {foreach from=$products item="product"} {if $product.quantity > 0} {include file="catalog/_partials/miniatures/product.tpl" product=$product} {assign var="displayedProducts" value=$displayedProducts+1} {/if} {if $displayedProducts >= 4} {break} {/if} {/foreach} {/while} via this code, it will skip the out of stock product , and will show the next product (will not be empty) this works with PS 1.8 as well Thanks Link to comment Share on other sites More sharing options...
Mian Waqas Posted February 8 Author Share Posted February 8 On 2/7/2024 at 11:31 PM, SeifF said: Hello, Thank you for sharing this helpful information! It seems like you've provided a workaround to hide out-of-stock products in a specific module/hook by modifying the corresponding template (tpl) file. This can be useful for those who want to customize the display of products in certain contexts, especially when dealing with out-of-stock items. It's important to note that modifying template files directly should be done carefully, and users should be aware of potential impacts on future updates and compatibility. Always make backups before making such changes. Your contribution may help others looking to achieve similar customizations in PrestaShop. If you have any more tips or insights, feel free to share! Have a nice day. Thank you for your endorsement 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