Jump to content

Change color for text in product-list-color


Recommended Posts

I want change the color-pick list when the product have atribbutes of color, for  " Availabe on more colours" and link to the product. I think that I have to modify product-list-color.tpl, but I don't know how.

<ul class="color_to_pick_list clearfix">
	{foreach from=$colors_list item='color'}
		{assign var='img_color_exists' value=file_exists($col_img_dir|cat:$color.id_attribute|cat:'.jpg')}
		<li>
			<a href="{$link->getProductLink($color.id_product, null, null, null, null, null, $color.id_product_attribute)|escape:'html':'UTF-8'}" id="color_{$color.id_product_attribute|intval}" class="color_pick"{if !$img_color_exists && isset($color.color) && $color.color} style="background:{$color.color};"{/if}>
				{if $img_color_exists}
					<img src="{$img_col_dir}{$color.id_attribute|intval}.jpg" alt="{$color.name|escape:'html':'UTF-8'}" title="{$color.name|escape:'html':'UTF-8'}" width="20" height="20" />
				{/if}
			</a>
		</li>
	{/foreach}
</ul>

post-742899-0-84245300-1404575977_thumb.jpg

post-742899-0-20456500-1404576057_thumb.jpg

Link to comment
Share on other sites

Not a problem as such, it is a modification. I would like to make Rather than display all the colors of the attributes, replace it with a text that reads "Available in more colors." I think that there must  create a function that indicates if there are attributes of color, showing the link of the product. Like the photo.

 

http://fiorella.es/12-Turbantes

Link to comment
Share on other sites

so just instead of whole <ul></ul> code there inserty a text where you will inform about that

 

{l s='available in more colors'}

The problem is then always would appear regardless if have color attributes right?

Link to comment
Share on other sites

The problem is then always would appear regardless if have color attributes right?

No, there is a condition inside product-list.tpl that would only show the string if the product has colors. This <ul></ul> list that you have pasted only shows up, if there are colors combinations within your product. So as Vekia said, comment it out and add the string to the product-list-color.tpl file.

It will in the end look like this:

{*
<ul class="color_to_pick_list clearfix">
{foreach from=$colors_list item='color'}
<li>
<a
href="{$link->getProductLink($color.id_product, null, null, null, null, null, $color.id_product_attribute)|escape:'html':'UTF-8'}"
id="color_{$color.id_product_attribute|intval}"
class="color_pick"
style="background: {$color.color};">
</a>
</li>
{/foreach}
</ul>
*}
{l s='available in more colors'}
Link to comment
Share on other sites

Thank you very much to  both. I am a newbie in this world, and I do not know a lot of things. Finally, I would like if possible, add to the text the link of the product.

Try this...leave out the entire product-list-color.tpl file as it is:

<ul class="color_to_pick_list clearfix">
{foreach from=$colors_list item='color'}
<li>
<a
href="{$link->getProductLink($color.id_product, null, null, null, null, null, $color.id_product_attribute)|escape:'html':'UTF-8'}"
id="color_{$color.id_product_attribute|intval}"
class="color_pick"
style="background: {$color.color};">
</a>
</li>
{/foreach}
</ul>

in product-list.tpl change this

{if isset($product.color_list)}
<div class="color-list-container">{$product.color_list} </div>
{/if}

to this:

{if isset($product.color_list)}
{*
<div class="color-list-container">{$product.color_list} </div>
*}
<a href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}" itemprop="url">
{l s='available in more colors'}
</a>
{/if}
Link to comment
Share on other sites

 

Try this...leave out the entire product-list-color.tpl file as it is:

<ul class="color_to_pick_list clearfix">
{foreach from=$colors_list item='color'}
<li>
<a
href="{$link->getProductLink($color.id_product, null, null, null, null, null, $color.id_product_attribute)|escape:'html':'UTF-8'}"
id="color_{$color.id_product_attribute|intval}"
class="color_pick"
style="background: {$color.color};">
</a>
</li>
{/foreach}
</ul>

in product-list.tpl change this

{if isset($product.color_list)}
<div class="color-list-container">{$product.color_list} </div>
{/if}

to this:

{if isset($product.color_list)}
{*
<div class="color-list-container">{$product.color_list} </div>
*}
<a href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}" itemprop="url">
{l s='available in more colors'}
</a>
{/if}

 

I tried this, but now is in all products, whether or not color attributes

Link to comment
Share on other sites

Do you have the IF statement in place? It should not do this, as I've simply replaced the colours with this link. Nothing else.

{if isset($product.color_list)}
						{*<div class="color-list-container">{$product.color_list} </div>*}
						 <a href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}" itemprop="url">{l s='available in more colors'}
							</a>
{/if}
					<div class="product-flags">

That's how I got in product-list.tpl

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

Are you sure that you're looking into a category, which contains products that do not have colours? Because I can't understand why it would show up...

Yes, I'm sure. For example http://fiorella.es/14-Bolsos this is the category and the products don't have colours, if you click in one product, you can see. I don't understand because it's happen..Something I did wrong..

Link to comment
Share on other sites

Yes, I'm sure. For example http://fiorella.es/14-Bolsos this is the category and the products don't have colours, if you click in one product, you can see. I don't understand because it's happen..Something I did wrong..

That's odd.

 

Can you try commenting out the product-list-color.tpl file again and place this line of code in?

<a href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}" itemprop="url">{l s='available in more colors'} </a>

And make the product-list as it was before again.

 

I am however not sure if the link is going to work or not. That's why I chose the other solution first.

Link to comment
Share on other sites

That's odd.

 

Can you try commenting out the product-list-color.tpl file again and place this line of code in?

<a href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}" itemprop="url">{l s='available in more colors'} </a>

And make the product-list as it was before again.

 

I am however not sure if the link is going to work or not. That's why I chose the other solution first.

W

 

That's odd.

 

Can you try commenting out the product-list-color.tpl file again and place this line of code in?

<a href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}" itemprop="url">{l s='available in more colors'} </a>

And make the product-list as it was before again.

 

I am however not sure if the link is going to work or not. That's why I chose the other solution first.

The last option also I had tried, and fails in the link. Link to the category,not the product. 
 
Maybe, I have committed any error by placing the code above, if you want, I upload the  files to check if it's my mistake, because I also think it is very strange..
Link to comment
Share on other sites

 

W

 

The last option also I had tried, and fails in the link. Link to the category,not the product. 
 
Maybe, I have committed any error by placing the code above, if you want, I upload the  files to check if it's my mistake, because I also think it is very strange..

 

Well, that's what I was afraid of - it does not lead to category, it simply does not lead anywhere and it redirects you to the same page. The first plan was probably the best I could do under these conditions.

Link to comment
Share on other sites

Well, that's what I was afraid of - it does not lead to category, it simply does not lead anywhere and it redirects you to the same page. The first plan was probably the best I could do under these conditions.

I'm going back to try the first option, with special care, to see if I can make it work. If don't work, I don't put the link

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