mercredi 28 août 2019

If group.group_type then do this in PrestaShop, problem

PrestaShop 1.7.5.x

How can I call the attribute group of the $group.group_type color? I need to have the colors that are in group[{$id_attribute_group}] for e.g. group_1, in the right column of product page.

I want to do something like:

{if $group.group_type == 'color' && id_attribute_group == '1'} then do this...

but it doesn't work, it calls only the first color of the group (but the id is correct!).

I have to do the same for radio

{if $group.group_type == 'radio' && id_attribute_group == '2'} then do this...

The basic code is:

 {elseif $group.group_type == 'color'}
    <ul id="group_{$id_attribute_group}">
      {foreach from=$group.attributes key=id_attribute item=group_attribute}

        <li class="float-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>
           <div class="colors-names">{$colors.$id_attribute.name}</div>
        </li>
      {/foreach}

Thanks if you can help me!

Aucun commentaire:

Enregistrer un commentaire