Jump to content

Hide X items in stock, when 0 items


Arj1

Recommended Posts

Hello

Im having some problem with stock quantity.

1. In my product-list I now display X items in stock, and thats ok. But when there is 0 items in stock, it shows both the text "Out of stock" and "0 items in stock". I only want the text to be displayed when the product is out of stock.

In product-list.tpl:

{$product.quantity} {if $product.quantity == 1}{l s='item in stock'}{else}{l s='items in stock'}  {/if}


{if $product.quantity > 0}{$product.available_now|escape:'quotes':'UTF-8'}{else}{if $product.allow_oosp}{$product.available_later|escape:'quotes':'UTF-8'}{else}{l s='Out of stock'}{/if}{/if} 




2. I have the same question for the product.tpl. It also shows the text "Out of stock" and "0 items in stock". But i only want the text on that page too.

In product.tpl:

           <!-- number of item in stock -->

quantity == 0)} style="display:none;"{/if}>
{$product->quantity|intval}

quantity > 1} style="display:none;"{/if} id="quantityAvailableTxt">{l s='item in stock'}
quantity < 2} style="display:none;"{/if} id="quantityAvailableTxtMultiple">{l s='items in stock'}


           <!-- Out of stock hook -->

quantity > 0} style="display:none;"{/if}>
               {$HOOK_PRODUCT_OOS}




Hopefully someone understands what i mean :D (Maybe the URL would help, but the page is not open yet)


Thanks in advance

/

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...