Jump to content

Display first attribute in stock on product page


julien_wmx

Recommended Posts

I'd like to find a way to display by default the first combination in stock.

 

First, I modified product.tpl to display only attributes where the quantity > 0  but I get the higher value and I'd like to get the first combination in stock.

{foreach from=$group.attributes key=id_attribute item=group_attribute}
   <li>
      <input type="radio" class="attribute_radio" name="{$groupName|escape:'html':'UTF-8'}" value="{$id_attribute}" {if (($group.default == $id_attribute) || ($group.default != $id_attribute && $group.attributes_quantity[{$id_attribute}] > 0)) } checked="checked"{/if} {if $group.attributes_quantity[{$id_attribute}] < 1 && !$allow_oosp}disabled="disabled"{/if}/>
          <span {if $group.attributes_quantity[{$id_attribute}] < 1 && !$allow_oosp}style="opacity:0.4; filter:alpha(opacity=40); text-decoration: line-through;"{/if}>{$group_attribute|escape:'html':'UTF-8'}</span>
    </li>
 {/foreach}

Anyone could help me to find this solution please ?

 

Exemple here: https://www.wimkite-shop.com/sweat-shirt-homme/74-sweat-mystic-brand-20-sweat.html

 

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