ach34 Posted March 10, 2016 Share Posted March 10, 2016 Je veux afficher des thumbs et la référence à la place de la couleur des attributs (code ci-dessous) pour faire mon choix couleur d'une fiche produit. Est-ce que quelqu'un peut m'aider ? Merci de votre aide product.tpl <ul id="color_to_pick_list" class="clearfix"> {assign var="default_colorpicker" value=""} {foreach from=$group.attributes key=id_attribute item=group_attribute} {assign var='img_color_exists' value=file_exists($col_img_dir|cat:$id_attribute|cat:'.jpg')} <li{if $group.default == $id_attribute} class="selected"{/if}> <a href="{$link->getProductLink($product)|escape:'html':'UTF-8'}" id="color_{$id_attribute|intval}" name="{$colors.$id_attribute.name|escape:'html':'UTF-8'}" class="color_pick{if ($group.default == $id_attribute)} selected{/if}"{if !$img_color_exists && isset($colors.$id_attribute.value) && $colors.$id_attribute.value} style="background:{$colors.$id_attribute.value|escape:'html':'UTF-8'};"{/if} title="{$colors.$id_attribute.name|escape:'html':'UTF-8'}"> {if $img_color_exists} <img src="{$img_col_dir}{$id_attribute|intval}.jpg" alt="{$colors.$id_attribute.name|escape:'html':'UTF-8'}" title="{$colors.$id_attribute.name|escape:'html':'UTF-8'}" width="20" height="20" /> {/if} </a> </li> {if ($group.default == $id_attribute)} {$default_colorpicker = $id_attribute} {/if} {/foreach} </ul> Link to comment Share on other sites More sharing options...
ach34 Posted March 10, 2016 Author Share Posted March 10, 2016 (edited) Finalement j'ai trouvé tout seul... Je sais pas si c'est le mieux mais ça marche ! <ul id="color_to_pick_list" class="clearfix"> {assign var="default_colorpicker" value=""} <!-- liste couleur thumb --> {if isset($images) && count($images) > 0} {foreach from=$combinations key=k item=v} <li {if $group.default == $v.attributes[0]} class="selected"{/if}> <a href="{$link->getProductLink($product)|escape:'html':'UTF-8'}" id="color_{$v.attributes[0]|intval}" name="{$v.attributes_values[3]|escape:'html':'UTF-8'}" title="{$v.attributes_values[3]|escape:'html':'UTF-8'}" class="color_pick"> <img class="img-responsive" id="thumb_{$k}" src="{$link->getImageLink($product->link_rewrite, $v.id_image, 'small_default')|escape:'html':'UTF-8'}" alt="{$imageTitle}" title="{$imageTitle} - {$v.reference}" /> <span>{$v.reference}</span> </a> </li> {if ($group.default == $v.attributes[0])} {$default_colorpicker = $v.attributes[0]} {/if} {/foreach} {/if} <!-- end liste couleur thumb --> </ul> Edited March 10, 2016 by ach34 (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now