taxonomy terms as view field

View: New views
5 Messages — Rating Filter:   Alert me  

taxonomy terms as view field

by Jeff Greenberg-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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?!



Re: taxonomy terms as view field

by Jeff Greenberg-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jeff Greenberg wrote:

>
> 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?!
>
Never mind...problem solved...was one of those forehead-smacking moments

Re: taxonomy terms as view field

by Josh Miller-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sounds like my day ;P

-----Original Message-----
From: development-bounces@...
[mailto:development-bounces@...] On Behalf Of Jeff Greenberg
Sent: Thursday, October 01, 2009 2:51 PM
To: development@...
Subject: Re: [development] taxonomy terms as view field

Jeff Greenberg wrote:

>
> 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?!
>
Never mind...problem solved...was one of those forehead-smacking moments

Re: taxonomy terms as view field

by nan wich :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Are you sure you need a view? Would taxonomy_menu, taxonomy_directory, or
taxonomy_list handle your need?

Nancy E. Wichmann, PMP
Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King,
Jr.


-----Original Message-----
From: development-bounces@...
[mailto:development-bounces@...]On Behalf Of Jeff Greenberg
Sent: Thursday, October 01, 2009 10:50 AM
To: development@...
Subject: [development] taxonomy terms as view field


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?!


No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.409 / Virus Database: 270.14.0/2406 - Release Date: 10/01/09
06:34:00


Re: taxonomy terms as view field

by Jeff Greenberg-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Josh Miller wrote:

Sounds like my day ;P


Nancy Wichmann wrote:

> Are you sure you need a view? Would taxonomy_menu, taxonomy_directory, or
> taxonomy_list handle your need?
>  

Josh, it continued after that.  I'm sure I'm doing something wrong, when
I dump $fields, and I end up spending an hour or three experimenting
until I end up with
$tid_title=taxonomy_get_term($fields['model']->handler->view->args[0])->name;  
It takes me sooo long (even with formatted print_r's) to get to the
value I need in that massive structure, same with $node.

Nancy, thanks for the idea. I'm ignorant as to whether that would
work...I'll do some reading for my next encounter. The part that makes
me uncertain is that the product has many fields that don't apply to
this 'catalog' view. The owner has standard products that will go
through checkout, so that have product description, price, etc.  The
other half or more of the products are affiliate products, where none of
that information is needed, because an iframe from the supplier provides
a photo, price and link to the product detail page. So I needed a
mechanism for an argument, selecting fields, and rewriting the output of
the product id as an iframe.

Jeff