Jump to content

affiche nom palette couleur déclinaison


Recommended Posts

  • 4 weeks later...

bonjour avez vous trouvé une solution?

pareil j ai que les carrés de couleurs, aucun nom de couleur s affiche. 

je ne sais pas si c est lié au thème que j ai acheté ou si c est prestashop 1.7 qui fait ça.

le client ne sait pas quelle couleur il selectionne en gros! 

Link to comment
Share on other sites

Bonjour, 

Dans votre thème Prestashop 1.7, vous avez un fichier /httpdocs/themes/yourtheme/templates/catalog/_partials/product-variant.tpl

Dedans, vous trouverez la variable $group_attribute.name et une condition {elseif $group.group_type == 'color'}.

Selon votre thème (et child theme fortement recommandé pour le coup) vous pourrez afficher le nom de la couleur en plus de son picto.

Link to comment
Share on other sites

j ai ceci:

 

<div class="product-variants">
  {foreach from=$groups key=id_attribute_group item=group}
    {if !empty($group.attributes)}
    <div class="clearfix product-variants-item">
      <span class="control-label">{$group.name}</span>
      {if $group.group_type == 'select'}
        <select
          class="form-control form-control-select"
          id="group_{$id_attribute_group}"
          data-product-attribute="{$id_attribute_group}"
          name="group[{$id_attribute_group}]">
          {foreach from=$group.attributes key=id_attribute item=group_attribute}
            <option value="{$id_attribute}" title="{$group_attribute.name}"{if $group_attribute.selected} selected="selected"{/if}>{$group_attribute.name}</option>
          {/foreach}
        </select>
      {elseif $group.group_type == 'color'}
        <ul id="group_{$id_attribute_group}">
          {foreach from=$group.attributes key=id_attribute item=group_attribute}
            <li class="pull-xs-left input-container">
           <label>
              <input class="input-color" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if}>
              <span
                {if $group_attribute.html_color_code}class="color" style="background-color: {$group_attribute.html_color_code}" {/if}
                {if $group_attribute.texture}class="color texture" style="background-image: url({$group_attribute.texture})" {/if}
              ><span class="sr-only">{$group_attribute.name}</span></span>        
   </label>
 </li>      
          {/foreach}
        </ul>
      {elseif $group.group_type == 'radio'}
        <ul id="group_{$id_attribute_group}">
          {foreach from=$group.attributes key=id_attribute item=group_attribute}
            <li class="input-container pull-xs-left">
            <label> 
              <input class="input-radio" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if}>
              <span class="radio-label">{$group_attribute.name}</span>
           </label>
           </li>
          {/foreach}
        </ul>
      {/if}
    </div>
    {/if}
  {/foreach}
</div>
 

Edited by PECHECERISE (see edit history)
Link to comment
Share on other sites

En fait il faudrait voir comment intégrer le code dans votre thème, cela dépend un peu de votre design. 

Un truc du genre :


      {elseif $group.group_type == 'color'}
        <ul id="group_{$id_attribute_group}">
          {foreach from=$group.attributes key=id_attribute item=group_attribute}
            <li class="pull-xs-left input-container">
           <label>
              <input class="input-color" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if}>
              <span class="evername">{$group_attribute.name}</span>
              <span
                {if $group_attribute.html_color_code}class="color" style="background-color: {$group_attribute.html_color_code}" {/if}
                {if $group_attribute.texture}class="color texture" style="background-image: url({$group_attribute.texture})" {/if}
              ><span class="sr-only">{$group_attribute.name}</span></span>  
                    
           </label>
         </li>      
          {/foreach}
        </ul>

Et avec ceci, vous auriez la class evername en CSS pour faire un peu de design sur cela.

Par contre, je n'ai absolument rien testé pour tout vous avouer.

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