Jump to content

Problem showing on product list when a product it's out of stock


Recommended Posts

To do that I'm using this code:

{if $product.quantity <= 0}
	<p id="oos-badge" class="icon-remove"></p>
{/if}

The problem is that when a product has multiple colors, and the default color quantity is zero the out of stock logo is showed, also if the product is available in different color.

 

Do you know if there's a way to show the oos badge only if all the attributes/colors are out of stock?

Link to comment
Share on other sites

You're talking about the front office, right?
I guess you are using a custom template, the default one would read "product available with different options".


 

										<span class="unvisible">
											{if ($product.allow_oosp || $product.quantity > 0)}
													<link itemprop="availability" href="http://schema.org/InStock" />{if $product.quantity <= 0}{if $product.allow_oosp}{if isset($product.available_later) && $product.available_later}{$product.available_later}{else}{l s='In Stock'}{/if}{else}{l s='Out of stock'}{/if}{else}{if isset($product.available_now) && $product.available_now}{$product.available_now}{else}{l s='In Stock'}{/if}{/if}
											{elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}
													<link itemprop="availability" href="http://schema.org/LimitedAvailability" />{l s='Product available with different options'}

											{else}
													<link itemprop="availability" href="http://schema.org/OutOfStock" />{l s='Out of stock'}
											{/if}
										</span>
Link to comment
Share on other sites

Hello Nemo,

I'm using the default template but I cutomized it a little bit.

 

Looking at the code you posted, do you think it works if i use something like this?

 
{if (!isset($product.quantity_all_versions) && $product.quantity <= 0}) || (isset($product.quantity_all_versions) && $product.quantity_all_versions <= 0)}
<p id="oos-badge" class="icon-remove"></p>
{/if}
 
Practically the oos badget should be showed only when products quantity and it's version are all <= 0.
 
 
 
{if $product.quantity <= 0}
<p id="oos-badge" class="icon-remove"></p>
{/if}
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...