Jump to content

Customized availability status in PS1.7


petitbruno

Recommended Posts

Hi,

I would like to modify the code of the product-add-to-cart.tpl file in our theme, in order to add the following condition :

when a product is out of stock but orders are allowed, we want to have an orange or red material-icon symbol (and not green as it is now), and the message indicating the availability date (as set in a product page of the BO, for instance "available in august").

Could anyone help me to correctly write the code ? Must be something like "if product quantity is < or = to zero, and product is available_for_order, then the class to use is <i class="material-icons product-last-items">&#xE002;</i>

The current code is :

 

    {block name='product_availability'}
      <span id="product-availability">
        {if $product.show_availability && $product.availability_message}
          {if $product.availability == 'available'}
            <i class="material-icons product-available">&#XE3FA;</i>
          {elseif $product.availability == 'last_remaining_items'}
            <i class="material-icons product-last-items">&#xE002;</i>
          {else}
            <i class="material-icons product-unavailable">&#XE5C9;</i>
          {/if}
          {$product.availability_message}
        {/if}
      </span>
      
      <p id="availability_date"{if ($product->quantity > 0) OR !$product->available_for_order OR $PS_CATALOG_MODE OR !isset($product->available_date) OR $product->available_date < $smarty.now|date_format:'%Y-%m-%d'} style="display: none;"{/if}>
   <span id="availability_date_label">{l s='Availability date:'}</span>
   <span id="availability_date_value">{dateFormat date=$product->available_date full=false}</span>
  </p>
    {/block}

 

Thank you for the support.

Bruno

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