4

I've set up taxonomy in Drupal 7 called Colours. I've added some terms (red, blue etc) and added a colour image to each term.

In a content type I have added a term reference field, so my client can choose colours (the colours in which that product is available).

In Views, rather than listing the taxonomy terms on the node page, I would like instead to output the image associated with the taxonomy term.

Any ideas on how to do this? I've tried endless "output this field as" in Views but just can't get it to work. The only way I've actually got it to work is to upload images when adding content, but that's not ideal obviously.

user789105
  • 41
  • 1
  • 2

3 Answers3

1

In Drupal 7 you have to add the taxonomy under "relationships". Then the taxonomy images will appear as fields in the view.

Josh
  • 11
  • 1
1

I had the same issue, all I did was adding a new field called "image" to the taxonomy and inside the view I just called that field. its working well.

saadlulu
  • 1,375
  • 2
  • 26
  • 38
0

Your best bet is to create a View Template, and in the template you can look at the value in that field and load the appropriate image in its place.

Here's a guide on doing this in Views 2: http://www.group42.ca/theming_views_2_the_basics

Couldn't find one for Views 3

GrayB
  • 539
  • 3
  • 9
  • The problem I've found is that taxonomy fields are not listed as tokens in Views :( Otherwise I could simply output Taxonomy:all terms with the taxonomy field [field-taxonomy-image]. Have you any idea how to get taxonomy fields to show in Views? – user789105 Jun 09 '11 at 10:15
  • They won't have to be tokens - in said template use the drupal functions to pull the appropriate taxonomies and display them. See api.drupal.org and one of the taxonomy* functions – GrayB Jun 09 '11 at 18:43