Jump to content

Colors problem


EtapDesign

Recommended Posts

Yes, in the combinations I've uploaded an image for each individual color in the back office.

 

For example: Size : S Color : red and a product associated.

 

In my product-list file, I have the code:

 

<a href="{$product.link|escape:'htmlall':'UTF-8'}" class="product_img_link" title="{$product.name|escape:'htmlall':'UTF-8'}"><img id="img_{$product.id_product}" src="{$link->getImageLink($product.link_rewrite, $id_product-id_image, 'home')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} /></a>
   <h3><a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.name|escape:'htmlall':'UTF-8'}">{$product.name|truncate:35:'...'|escape:'htmlall':'UTF-8'}</a></h3>


{if isset($product.colors) && $product.colors}
		 <p class="colors">
			  {foreach from=$product.colors key='id_attribute' item='color'}
						 <a onclick="document.getElementById('img_{$product.id_product}').src='{$img_prod_dir}{$product.id_product}-{$color.id_image}.jpg'" class="color_pick" title="{$color.name}"  style="background: {$color.value};"></a>
			  {/foreach}
		 </p>
{/if}

 

I think the problem is here no?

 

Mainly :

<p class="colors">
			  {foreach from=$product.colors key='id_attribute' item='color'}
						 <a onclick="document.getElementById('img_{$product.id_product}').src='{$img_prod_dir}{$product.id_product}-{$color.id_image}.jpg'" class="color_pick" title="{$color.name}"  style="background: {$color.value};"></a>
			  {/foreach}
		 </p>

 

 

Sorry to my english bad.

 

Thank you!

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