Jump to content

Two attributes "color" display on category page


Recommended Posts

Hello

I have products with two attributes type "color" (one for material  {$group.name}="Kolor"   and one for printing  {$group.name}="Nadruk").

I want to show them on mailn page / category page only with material colors  {$group.name}="Kolor"

Now it's mixed - every colors (material and printing) displays together:

oby-main.png.23380c5c53ee7e05aa6a328381008bd6.png

How to change this code to show only colors from group "Kolor"  (  {$group.name}="Kolor"  )

{block name='variant_links'}
  <div class="variant-links">
    {foreach from=$variants item=variant}
      {block name='variant_link_item'}
        <a href="{$variant.url}"
           class="{$variant.type}"
           {if $variant.type === "color"} style="background-color: {$variant.html_color_code}" {/if}
        >
          {$variant.name}
        </a>
      {/block}
    {/foreach}
  </div>
{/block}

 

Regards

 

oby-Kolor.png

Share this post


Link to post
Share on other sites

Thanks but i found $group.name  in  product-variants.tpl file.

But i need  change variant-links.tpl where $group.name doesn't work.

{block name='variant_links'}
  <div class="variant-links">
    {foreach from=$variants item=variant}
      {block name='variant_link_item'}
        <a href="{$variant.url}"
           class="{$variant.type}"
           {if $variant.type === "color"} style="background-color: {$variant.html_color_code}" {/if}
        >
          {$variant.name}
        </a>
      {/block}
    {/foreach}
  </div>
{/block}

 

Edited by MMaTT
edit html code (see edit history)

Share this post


Link to post
Share on other sites
  • 1 year later...

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

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More