Hi. I created a view that had a taxonomy term name for an argument, and also a "taxonomy: term from X" as one of the filters. This caused no results to show up. I took a look at the query it actually generated:

SELECT node.nid, rand() AS random_sort 
FROM {node} node  
    LEFT JOIN {term_node} term_node ON node.nid = term_node.nid 
    LEFT JOIN {term_hierarchy} term_hierarchy ON term_node.tid = term_hierarchy.tid 
    LEFT JOIN {term_data} term_data ON term_node.tid = term_data.tid 

WHERE (node.type IN ('image')) AND (term_node.tid = '112') AND (term_data.name = 'Rocket To The Moon')  ORDER BY random_sort ASC

It seems as though I'm looking for somethign that has BOTH the tid of 112 AND the name "rocket to the moon". There is no such element. The tid of 112 comes from the filter. The name of "Rocket To The Moon" comes from the argument.

The argument handler should be adding the term_node and term_data tables into the join again.

This patch does that.

CommentFileSizeAuthor
views-taxonomy-args.patch1.26 KBAnonymous (not verified)

Comments

Anonymous’s picture

Anyone had a chance to look at this one yet?

vanvemden’s picture

Same problem here. Tried to apply the patch but got error (Hunk #1 FAILED at 394) on my file views_taxonomy.inc (// $Id: views_taxonomy.inc,v 1.27.2.12 2007/07/14 19:30:51 merlinofchaos Exp $) I'll try to make changes manually and will report back.

vanvemden’s picture

Applied patch manually and can confirm it solved the problem. Thanks, linuxbox, could not have done it myself! Sorry, can't give an expert opinion on the solution.

Anonymous’s picture

I'd like to bump this bugfix one more time: What are the odds of this getting incorporated?

sun’s picture

Status: Needs review » Needs work

Requirements:

1) Coding style.
2) Marked as RTBC from another community member who applied and tested this patch.
3) At least one or two more confirmations by other community members that this patch in RTBC state works and does NOT conflict with other views.

BAJV’s picture

I cannot found the views_taxonomy.inc file. I wonder, is this patch applies to Views version 1 or Views version 2?

Thanks for any response.

tootsietorres’s picture

Is there a version of this patch for Views 2? Or another solution?

Thanks,
Tootsie

iainh’s picture

Component: Code » taxonomy data

If I "Select terms from vocabulary" and select a specific term, then the generated SQL is invalid; seems to miss the alias prefix from the "(.tid = 6)" in the WHERE clause.

SELECT comments.cid AS cid, 
comments.subject AS comments_subject, 
comments.nid AS comments_nid, 
comments.comment AS comments_comment, 
comments.format AS comments_format 
FROM comments comments  
WHERE (comments.timestamp >= -86400) AND (.tid = 6)
esmerel’s picture

Status: Needs work » Closed (won't fix)

No changes are being made to 1.x at this time.