Show Product Option Variant Name

Hi good morning,

I try to put the product option variant name showing in the products categorie page, but so for I have only been able to put the option weight modifier.

That is the code that I use to capture the weight modifier:

{if $product.selected_options}
  
{__("embalagem")} {$product.selected_options|fn_apply_options_modifiers:$product.weight:'W'} {$settings.General.weight_symbol}
{/if}

Can someone tell me the code to catch de variant name.

Example of the final result that I want in attached images.[attachment=13673:Sem Título2.jpg]

Sem Título2.jpg

Hello

Probably it will not be so easy because the options are not needed in the list so they probably are not taken from the database.

You would have to add support to the hook and retrieve this information when displaying the list.

Best regards

Robert

Try the following code

{if $product.selected_options}
  
{foreach from=$product.selected_options item=variant_id} {"SELECT variant_name FROM ?:product_option_variants_descriptions WHERE variant_id = ?i AND lang_code = ?s"|db_get_field:$variant_id:$smarty.const.CART_LANGUAGE} {/foreach}
{/if}

(!) Not tested

Try the following code

{if $product.selected_options}
  
{foreach from=$product.selected_options item=variant_id} {"SELECT variant_name FROM ?:product_option_variants_descriptions WHERE variant_id = ?i AND lang_code = ?s"|db_get_field:$variant_id:$smarty.const.CART_LANGUAGE} {/foreach}
{/if}

(!) Not tested

Works perfectly!!!

Thanks you for your help