Jump to content

Disable out of stock product from listing only


Dobre Ceny

Recommended Posts

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  :)

  • Like 2
Link to comment
Share on other sites

  • 3 weeks later...
  • 3 months later...
  • 8 months later...
  • 9 months later...
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

  • Thanks 1
Link to comment
Share on other sites

  • 1 month later...
  • 2 years later...
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

  • 1 year later...
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...