Hi,
I have a taxonomy views page with terms have a lot of child term.For example
Term Parent A
--- First Child B
------Child of First Child B
---------Child of child of first child B

And in this view when I try to select Term Parent A I got all terms in my view. (Parent A, First Child B, Child of First Child B...) But when I choose First Child B my views return with First Child B and all child terms. But Parent A term is missing in my view. And if I choose the Child of child of first child B term I got only Child of child of first child B term related items. I want to get all terms with parent items to be shown in my view. Here is my view export. I searched forums but got no answer to my problem.
http://i66.tinypic.com/wh1v1i.png // my view photo

$view = new view();
$view->name = 'taxonomy_tiv_term';
$view->description = 'A view to emulate Drupal core\'s handling of taxonomy/term.';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Taxonomy_tiv term';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['use_ajax'] = TRUE;
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['query']['options']['query_comment'] = FALSE;
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['exposed_form']['options']['submit_button'] = 'ARA';
$handler->display->display_options['exposed_form']['options']['reset_button'] = TRUE;
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '0';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['pager']['options']['id'] = '0';
$handler->display->display_options['pager']['options']['quantity'] = '9';
$handler->display->display_options['style_plugin'] = 'datatables';
$handler->display->display_options['style_options']['columns'] = array(
'title' => 'title',
'field_makaleresim' => 'field_makaleresim',
'field_drugimage' => 'field_drugimage',
'field_drugstagnew' => 'field_drugstagnew',
);
$handler->display->display_options['style_options']['default'] = '-1';
$handler->display->display_options['style_options']['info'] = array(
'title' => array(
'sortable' => 0,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '-----',
'empty_column' => 0,
),
'field_makaleresim' => array(
'sortable' => 0,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '------',
'empty_column' => 0,
),
'field_drugimage' => array(
'sortable' => 0,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '--------',
'empty_column' => 0,
),
'field_drugstagnew' => array(
'sortable' => 0,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
);
$handler->display->display_options['style_options']['elements'] = array(
'search_box' => 1,
'table_info' => 1,
'save_state' => 0,
'table_tools' => 0,
);
$handler->display->display_options['style_options']['layout'] = array(
'autowidth' => 1,
'themeroller' => 0,
'sdom' => '',
);
$handler->display->display_options['style_options']['pages'] = array(
'pagination_style' => '0',
'length_change' => 0,
'display_length' => '25',
);
/* Relationship: Content: Taxonomy terms on node */
$handler->display->display_options['relationships']['term_node_tid']['id'] = 'term_node_tid';
$handler->display->display_options['relationships']['term_node_tid']['table'] = 'node';
$handler->display->display_options['relationships']['term_node_tid']['field'] = 'term_node_tid';
$handler->display->display_options['relationships']['term_node_tid']['vocabularies'] = array(
'drugstag' => 'drugstag',
'forums' => 0,
'articles' => 0,
'department' => 0,
'doktorbrans' => 0,
'gender' => 0,
'makaletur' => 0,
'newsletter_categories' => 0,
'tags' => 0,
'event_calendar_status' => 0,
);
/* Relationship: Taxonomy term: Parent term */
$handler->display->display_options['relationships']['parent']['id'] = 'parent';
$handler->display->display_options['relationships']['parent']['table'] = 'taxonomy_term_hierarchy';
$handler->display->display_options['relationships']['parent']['field'] = 'parent';
$handler->display->display_options['relationships']['parent']['relationship'] = 'term_node_tid';
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
/* Field: Content: MakaleResim */
$handler->display->display_options['fields']['field_makaleresim']['id'] = 'field_makaleresim';
$handler->display->display_options['fields']['field_makaleresim']['table'] = 'field_data_field_makaleresim';
$handler->display->display_options['fields']['field_makaleresim']['field'] = 'field_makaleresim';
$handler->display->display_options['fields']['field_makaleresim']['label'] = '';
$handler->display->display_options['fields']['field_makaleresim']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['field_makaleresim']['click_sort_column'] = 'fid';
$handler->display->display_options['fields']['field_makaleresim']['type'] = 'colorbox';
$handler->display->display_options['fields']['field_makaleresim']['settings'] = array(
'colorbox_node_style' => 'thumbnail',
'colorbox_node_style_first' => '',
'colorbox_image_style' => '',
'colorbox_gallery' => 'post',
'colorbox_gallery_custom' => '',
'colorbox_caption' => 'auto',
'colorbox_caption_custom' => '',
);
/* Field: Content: DrugImage */
$handler->display->display_options['fields']['field_drugimage']['id'] = 'field_drugimage';
$handler->display->display_options['fields']['field_drugimage']['table'] = 'field_data_field_drugimage';
$handler->display->display_options['fields']['field_drugimage']['field'] = 'field_drugimage';
$handler->display->display_options['fields']['field_drugimage']['label'] = '';
$handler->display->display_options['fields']['field_drugimage']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['field_drugimage']['click_sort_column'] = 'fid';
$handler->display->display_options['fields']['field_drugimage']['settings'] = array(
'image_style' => 'thumbnail',
'image_link' => 'content',
);
/* Field: Content: drugstagnew */
$handler->display->display_options['fields']['field_drugstagnew']['id'] = 'field_drugstagnew';
$handler->display->display_options['fields']['field_drugstagnew']['table'] = 'field_data_field_drugstagnew';
$handler->display->display_options['fields']['field_drugstagnew']['field'] = 'field_drugstagnew';
$handler->display->display_options['fields']['field_drugstagnew']['label'] = '';
$handler->display->display_options['fields']['field_drugstagnew']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['field_drugstagnew']['type'] = 'i18n_taxonomy_term_reference_link';
/* Sort criterion: Content: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Contextual filter: Content: Has taxonomy term ID (with depth) */
$handler->display->display_options['arguments']['term_node_tid_depth']['id'] = 'term_node_tid_depth';
$handler->display->display_options['arguments']['term_node_tid_depth']['table'] = 'node';
$handler->display->display_options['arguments']['term_node_tid_depth']['field'] = 'term_node_tid_depth';
$handler->display->display_options['arguments']['term_node_tid_depth']['default_action'] = 'default';
$handler->display->display_options['arguments']['term_node_tid_depth']['default_argument_type'] = 'taxonomy_tid';
$handler->display->display_options['arguments']['term_node_tid_depth']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['term_node_tid_depth']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['term_node_tid_depth']['summary_options']['items_per_page'] = '25';
$handler->display->display_options['arguments']['term_node_tid_depth']['validate']['type'] = 'taxonomy_term';
$handler->display->display_options['arguments']['term_node_tid_depth']['validate_options']['vocabularies'] = array(
'drugstag' => 'drugstag',
);
$handler->display->display_options['arguments']['term_node_tid_depth']['depth'] = '5';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = '1';
$handler->display->display_options['filters']['status']['group'] = 1;
/* Filter criterion: Content: Has taxonomy terms (with depth) */
$handler->display->display_options['filters']['term_node_tid_depth']['id'] = 'term_node_tid_depth';
$handler->display->display_options['filters']['term_node_tid_depth']['table'] = 'node';
$handler->display->display_options['filters']['term_node_tid_depth']['field'] = 'term_node_tid_depth';
$handler->display->display_options['filters']['term_node_tid_depth']['exposed'] = TRUE;
$handler->display->display_options['filters']['term_node_tid_depth']['expose']['operator_id'] = 'term_node_tid_depth_op';
$handler->display->display_options['filters']['term_node_tid_depth']['expose']['label'] = 'Has taxonomy terms (with depth)';
$handler->display->display_options['filters']['term_node_tid_depth']['expose']['operator'] = 'term_node_tid_depth_op';
$handler->display->display_options['filters']['term_node_tid_depth']['expose']['identifier'] = 'term_node_tid_depth';
$handler->display->display_options['filters']['term_node_tid_depth']['expose']['remember_roles'] = array(
2 => '2',
1 => 0,
3 => 0,
4 => 0,
);
$handler->display->display_options['filters']['term_node_tid_depth']['reduce_duplicates'] = TRUE;
$handler->display->display_options['filters']['term_node_tid_depth']['type'] = 'select';
$handler->display->display_options['filters']['term_node_tid_depth']['vocabulary'] = 'drugstag';
$handler->display->display_options['filters']['term_node_tid_depth']['hierarchy'] = 1;
$handler->display->display_options['filters']['term_node_tid_depth']['depth'] = '5';

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'taxonomy/term/%';

/* Display: Feed */
$handler = $view->new_display('feed', 'Feed', 'feed');
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = 15;
$handler->display->display_options['style_plugin'] = 'rss';
$handler->display->display_options['row_plugin'] = 'node_rss';
$handler->display->display_options['path'] = 'taxonomy/term/%/%/feed';
$handler->display->display_options['displays'] = array(
'page' => 'page',
'default' => 0,
);

/* Display: TviModule */
$handler = $view->new_display('page', 'TviModule', 'page_1');
$handler->display->display_options['path'] = 'taxonomy/term/%';

Comments

Stefan Lehmann’s picture

As far as I know that's not going to work the way you want it to work. A relationship will only give you some additional info, but won't display more items in your view. If you add a filter it will actually _filter your view_.

So why do you want to have a filter, if you don't want to actually change the content of the view?

I like cookies!

bidb’s picture

I use this filter for filter the taxonomy with only choosen term child and parents shown in the view.The filter job is getting the deepest level(child terms) of choosen terms. If I don't choose the filter I can't get even any child of the choosen term.But when I add the filter, the filter gets only the child terms not parents. And I also try to implement the simple hierarchy module to get what I want but still don't work. I got child terms but no parents is showing

Stefan Lehmann’s picture

Did you have a look at this module: https://www.drupal.org/project/views_tree ?

I like cookies!

bidb’s picture

Yes I try this module too but didn't work too. Only child terms are shown but parents not.

bidb’s picture

up... My problem still needs to be solve

bidb’s picture

Up again. Any suggestions ?

Stefan Lehmann’s picture

Hey .. as said, if you add a filter, features will actually filter your View. If you want to show the parents you will have to invent something. You could for instance create a custom select filter via hook_form_alter() where you can select the deepest level child terms, but it actually only filters for the uppermost level term tid by setting the value of an option to the parent level tid, but set the label one of to the child terms.

Have a look at the form API, how to do that. Also google will show you how to override exposed filter forms.

I like cookies!