[development] taxonomy terms as view field

Jeff Greenberg jeff at ayendesigns.com
Thu Oct 1 14:50:08 UTC 2009


I'm having a devil of a time. I need to replace the Ubercart catalog 
page with my own. They don't use a template, so I've created a view and 
will just change my menu links to suit (cat instead of catalog). The 
title of the page needs to be the taxonomy term of the product. There's 
no setting for that in view. So I will have the taxonomy term as a field 
that isn't displayed, and grab it in the template and use it for the title.


The first problem is that Taxonomy Term as a field choice does not all 
specifying a vocabulary ID. The product's brand is a vocabulary, and so 
is the catalog, so I can't specify that the field be taxonomy term, 
because what I get back is unpredictable.


So I made it All Taxonomy Terms, which -does- let me specify the 
vocabulary. The trouble there, is that with a hierarchical vocabulary, 
even though there is only one term selected when creating the node, all 
parent terms are returned in the term field. Ok, so I'll just use the 
final term in the template for the title.


What happens is that in the live preview for the page, the taxonomy 
terms are listed. But when I dump $row in the template 
(views-view-fields--viewname--page.tpl.php) the row contains the other 
fields, but not the taxonomy terms field?!




More information about the development mailing list