Jump to content

[SOLVED] Create or adapt product attribute?


Recommended Posts

Hello, first post here, please be gentle.

The product I need to present has two main categories, one that would be colors (easy), and one that would require pictures. As it happens, Prestashop does allow the color attribute to show pictures instead of colors. Problem is, these are small, like very small. So after some work, I've managed to increase the side of the "buttons" to something where you can actually see what is shown on them. Obviously, though, the actual color buttons have grown accordingly, which is not something I'd want to keep that way. Is there any way at all to differenciate the two?


edit: never mind, I found out on my own, please close this topic.

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

Ah, sorry, sure, it's actually obvious and easy if you know a bit of html/css, it just didn't occur to me until I posted here. In product.css, do the following change (L234)

#attributes .attribute_list #color_to_pick_list a.color_pick {
	min-height: 20px;
	/*height:20px;  original height setting */
	min-width: 20px;
	/*width:20px;	 original width setting */

That way, by default, the color squares stay at 20 px, and it'll adapt to the size of the picture you'll otherwise use (you can of course change the size to something else). It is not enough though, as the picture itself is also hard-coded at 20px in size.

Now in product.tbl, find the following line (L304):

	<img src="{$img_col_dir}{$id_attribute}.jpg" alt="{$colors.$id_attribute.name}" width="20" height="20" /><br />

and put whatever size you want for the pictures. I recommand you use 100% for width and height, and create the pictures the size they need to be, that way, you can have multiple sizes if you so wish.

And you're done.

  • Like 1
Link to comment
Share on other sites

This topic is now closed to further replies.
  • Create New...