Jump to content

Opposite of {if $product.availability == 'available'}


TheSmithsDoBusiness

Recommended Posts

This works for me:

 

{block name='product_miniature_item'}

        {if $product.quantity > 0}
            <label class="label">{l s='availability: ' d='Shop.Theme.Catalog'} </label>
            <span class="availability-list-in-stock">On stock</span>

       {else}
            <label class="label">{l s='availability: ' d='Shop.Theme.Catalog'} </label>
            <span class="availability-list-in-stock">Out of stock</span>       
{/if}

{/block}

Link to comment
Share on other sites

23 hours ago, TheSmithsDoBusiness said:

Hello,

 

I need to add specific classes to various elements on the product page but only when the product is out of stock. I basically need the opposite of 


{if $product.availability == 'available'} CONTENT {/if}

Any help is much appreciated.

 

Thanks :)

Availability is a flag for the product in the database that you can set. It is unrelated to the stock.

Link to comment
Share on other sites

On 4/13/2021 at 3:55 PM, marketyellow3 said:

This works for me:

 

{block name='product_miniature_item'}

        {if $product.quantity > 0}
            <label class="label">{l s='availability: ' d='Shop.Theme.Catalog'} </label>
            <span class="availability-list-in-stock">On stock</span>

       {else}
            <label class="label">{l s='availability: ' d='Shop.Theme.Catalog'} </label>
            <span class="availability-list-in-stock">Out of stock</span>       
{/if}

{/block}

Will give this a try tomorrow and see how it goes. Thanks 😊

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