Dobre Ceny Posted June 17, 2016 Share Posted June 17, 2016 Hello PrestaShop users, do you know if it's possible to hide 'out of stock' product from listing, whereas product page is still available? Many thanks in advance, cheers! Link to comment Share on other sites More sharing options...
MEG Venture Posted June 17, 2016 Share Posted June 17, 2016 Hi This is a little bit tricky. Please follow the below instructions carefully. 1. Backup themes>yourtheme>product-list.tpl as product-list.tpl_ 2. Open themes>yourtheme>product-list.tpl Find {assign var='nbLi' value=$products|@count} Right below that line add {foreach from=$products item=product name=products} {if ($product.quantity <= 0)} {$nbLi=$nbLi-1} {/if} {/foreach} Find {foreach from=$products item=product name=products} Right below that line add {if ($product.quantity > 0)} Find {/foreach} Right above that line add {/if} 3. Replace all instances of $smarty.foreach.products.total and $smarty.foreach.products.iteration with $nbLi Cheers 2 Link to comment Share on other sites More sharing options...
Dobre Ceny Posted June 20, 2016 Author Share Posted June 20, 2016 Yup, seems to work, thanks! I just only need to check if that would work with front-end plugins. Link to comment Share on other sites More sharing options...
MEG Venture Posted June 20, 2016 Share Posted June 20, 2016 Don't worry. They will definitely work unless either of them overrides the product-list.tpl. Link to comment Share on other sites More sharing options...
Dobre Ceny Posted July 12, 2016 Author Share Posted July 12, 2016 (edited) Thank you MEG Venture, it works, but it breaks our responsive css. Any solution? Edited July 12, 2016 by Dobre Ceny (see edit history) Link to comment Share on other sites More sharing options...
Sasni Posted November 3, 2016 Share Posted November 3, 2016 Good But... Count show all products (visible and hide) It's possible to count only visible? Link to comment Share on other sites More sharing options...
fibo Posted July 13, 2017 Share Posted July 13, 2017 Thank you Meg Venture.I've 1.16.1.14 and it works for me Link to comment Share on other sites More sharing options...
fibo Posted July 13, 2017 Share Posted July 13, 2017 I ask myself if it was possible made a similar change to product.tpl to cancel from the dropdown all the combinations not avaible Link to comment Share on other sites More sharing options...
Daniel Santana Posted April 30, 2018 Share Posted April 30, 2018 On 17/6/2016 at 5:47 PM, MEG Venture said: Hi This is a little bit tricky. Please follow the below instructions carefully. 1. Backup themes>yourtheme>product-list.tpl as product-list.tpl_ 2. Open themes>yourtheme>product-list.tpl Find {assign var='nbLi' value=$products|@count} Right below that line add {foreach from=$products item=product name=products} {if ($product.quantity <= 0)} {$nbLi=$nbLi-1} {/if} {/foreach} Find {foreach from=$products item=product name=products} Right below that line add {if ($product.quantity > 0)} Find {/foreach} Right above that line add {/if} 3. Replace all instances of $smarty.foreach.products.total and $smarty.foreach.products.iteration with $nbLi Cheers Amazing, thanks 1 Link to comment Share on other sites More sharing options...
cyber Posted June 3, 2018 Share Posted June 3, 2018 not function it's visible only product quantity 0 :-( Link to comment Share on other sites More sharing options...
juanmlg Posted February 23, 2021 Share Posted February 23, 2021 On 6/17/2016 at 11:47 PM, MEG Venture said: Hi This is a little bit tricky. Please follow the below instructions carefully. 1. Backup themes>yourtheme>product-list.tpl as product-list.tpl_ 2. Open themes>yourtheme>product-list.tpl Find {assign var='nbLi' value=$products|@count} Right below that line add {foreach from=$products item=product name=products} {if ($product.quantity <= 0)} {$nbLi=$nbLi-1} {/if} {/foreach} Find {foreach from=$products item=product name=products} Right below that line add {if ($product.quantity > 0)} Find {/foreach} Right above that line add {/if} 3. Replace all instances of $smarty.foreach.products.total and $smarty.foreach.products.iteration with $nbLi Cheers Its possible to do it only in the Prices-drop.tpl? Link to comment Share on other sites More sharing options...
letrof Posted March 4, 2022 Share Posted March 4, 2022 On 6/17/2016 at 11:47 PM, MEG Venture said: Hi This is a little bit tricky. Please follow the below instructions carefully. 1. Backup themes>yourtheme>product-list.tpl as product-list.tpl_ 2. Open themes>yourtheme>product-list.tpl Find {assign var='nbLi' value=$products|@count} Right below that line add {foreach from=$products item=product name=products} {if ($product.quantity <= 0)} {$nbLi=$nbLi-1} {/if} {/foreach} Find {foreach from=$products item=product name=products} Right below that line add {if ($product.quantity > 0)} Find {/foreach} Right above that line add {/if} 3. Replace all instances of $smarty.foreach.products.total and $smarty.foreach.products.iteration with $nbLi Cheers Is it possible to hide only those products that have quantity<0 AND have no availability date? I've tried [code]{if $product_available_date && $smarty.now < $product_available_date|strtotime && $product.quantity_available <= 0}[/code] But it doesn't work. 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