3

I am making a view that gives the title of an article. It has a term reference field. Taxonomy tree is somewhat like:

  1. A
    • a
    • b
    • c
  2. B
    • 1
    • 2
    • 3

So I want to make a view that work in such a way that when one is on the taxonomy term page "a", he could see all the relevant title of taxonomy term 'a','b' and 'c'.

This is the query that the view has generated.

SELECT node.title AS node_title, node.nid AS nid, node.language AS node_language, node.created AS node_created, node_counter.totalcount AS node_counter_totalcount FROM {node} node LEFT JOIN {field_data_field_categories} field_data_field_categories ON node.nid = field_data_field_categories.entity_id AND (field_data_field_categories.entity_type = 'node' AND field_data_field_categories.deleted = '0') INNER JOIN {taxonomy_term_data} taxonomy_term_data_field_data_field_categories ON field_data_field_categories.field_categories_tid = taxonomy_term_data_field_data_field_categories.tid LEFT JOIN {taxonomy_term_hierarchy} taxonomy_term_data_field_data_field_categories__taxonomy_term_hierarchy ON taxonomy_term_data_field_data_field_categories.tid = taxonomy_term_data_field_data_field_categories__taxonomy_term_hierarchy.tid LEFT JOIN {node_counter} node_counter ON node.nid = node_counter.nid WHERE (( (taxonomy_term_data_field_data_field_categories__taxonomy_term_hierarchy.parent = '46' ) )AND(( (node.status = '1') AND (node.type IN ('article')) AND (node.language IN ('en')) ))) ORDER BY node_created DESC, node_counter_totalcount DESC LIMIT 7 OFFSET 0

But is still not working.

1
  • I replicated the situation in my system, the problem with the query above is that taxonomy_term_data_field_data_field_categories__taxonomy_term_hierarchy.parent = '46' is not actually the parent. It's the taxonomy term id, taken straight from the context filter, and put in the parent's place. It should have been the parent of parent of taxonomy term id (46) instead. Commented Oct 29, 2013 at 13:43

1 Answer 1

4

Can you create contextual filter in Views -> taxonomy parent term ID. This should work.

2
  • I required the field_categories relationship, and then added the contexual filter taxonomy parent term, but it's still not working. Commented Oct 29, 2013 at 10:28
  • A little bit delay in answer ;) , but did you try "uncheking" that relation. ? Commented Dec 6, 2013 at 16:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.