I've been bumping my head against this for awhile now and can't seem to get it right. I started out with two taxonomy arguments to a view, state and city. This worked fine. But then I added a filter to the view for another taxonomy term belonging to another vocabulary, "crime" let's say, and immediately got no output from the view. I figured this out, that the SQL generated by views was looking for taxonomy.name = "city" and taxonomy.name = "crime". Of course this didn't work.
So I went back, deleted the filter and added another taxonomy argument and set it to "fixed" with the argument name "crime". This however is not working. Whenever I test and enter arguments say "oklahoma/owasso" I assumed (big mistake there) that the 3rd argument would automatically be set to "crime" but it is not. Actually there is no reference at all to this 3rd "fixed" argument in the views-generated SQL I'm trying to pass in. Any idea what I'm doing wrong/how to make this work, or is there another better solution I haven't found?
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | export.txt | 9.34 KB | fblevins |
Comments
Comment #1
merlinofchaos commentedCan you please attach or paste an export of the view you're talking about? It will be a lot easier to guess if we can see what you've configured. (THis is requested specifically in the issue submission guidelines. Please read them).
Comment #2
fblevins commentedNot a problem and thx. I'll go find the guidlines. Here's the export:
$view = new view;
$view->name = 'news_general_interest_other';
$view->description = 'Other recent general interest';
$view->tag = 'custom';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
'tid' => array(
'id' => 'tid',
'table' => 'term_node',
'field' => 'tid',
),
));
$handler->override_option('sorts', array(
'created' => array(
'id' => 'created',
'table' => 'node',
'field' => 'created',
),
));
$handler->override_option('arguments', array(
'name' => array(
'id' => 'name',
'table' => 'term_data',
'field' => 'name',
),
));
$handler->override_option('filters', array(
'name' => array(
'id' => 'name',
'table' => 'term_data',
'field' => 'name',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler = $view->new_display('panel_pane', 'Other general interest news', 'panel_pane_1');
$handler->override_option('fields', array(
'tid' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'type' => 'separator',
'separator' => ', ',
'link_to_taxonomy' => 1,
'limit' => 1,
'vids' => array(
'1' => 1,
'2' => 0,
),
'exclude' => 0,
'id' => 'tid',
'table' => 'term_node',
'field' => 'tid',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
'title' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
));
$handler->override_option('sorts', array(
'created' => array(
'order' => 'DESC',
'granularity' => 'second',
'id' => 'created',
'table' => 'node',
'field' => 'created',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
));
$handler->override_option('arguments', array(
'name' => array(
'default_action' => 'ignore',
'style_plugin' => 'default_summary',
'style_options' => array(),
'wildcard' => 'all',
'wildcard_substitution' => 'All',
'title' => '',
'breadcrumb' => '',
'default_argument_type' => 'fixed',
'default_argument' => '',
'validate_type' => 'none',
'validate_fail' => 'not found',
'glossary' => 0,
'limit' => '0',
'case' => 'none',
'path_case' => 'none',
'transform_dash' => 0,
'add_table' => 0,
'require_value' => 0,
'id' => 'name',
'table' => 'term_data',
'field' => 'name',
'validate_user_argument_type' => 'uid',
'validate_user_roles' => array(
'2' => 0,
),
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
'default_options_div_prefix' => '',
'default_argument_fixed' => '',
'default_argument_user' => 0,
'default_argument_php' => '',
'validate_argument_node_type' => array(
'panel' => 0,
'book' => 0,
'news_article' => 0,
'page' => 0,
'story' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'2' => 0,
'1' => 0,
),
'validate_argument_type' => 'tid',
'validate_argument_transform' => 0,
'validate_user_restrict_roles' => 0,
'validate_argument_node_flag_name' => '*relationship*',
'validate_argument_node_flag_test' => 'flaggable',
'validate_argument_node_flag_id_type' => 'id',
'validate_argument_user_flag_name' => '*relationship*',
'validate_argument_user_flag_test' => 'flaggable',
'validate_argument_user_flag_id_type' => 'id',
'validate_argument_php' => '',
),
'name_1' => array(
'default_action' => 'ignore',
'style_plugin' => 'default_summary',
'style_options' => array(),
'wildcard' => 'all',
'wildcard_substitution' => 'All',
'title' => '',
'breadcrumb' => '',
'default_argument_type' => 'fixed',
'default_argument' => '',
'validate_type' => 'none',
'validate_fail' => 'not found',
'glossary' => 0,
'limit' => '0',
'case' => 'none',
'path_case' => 'none',
'transform_dash' => 0,
'add_table' => 0,
'require_value' => 0,
'id' => 'name_1',
'table' => 'term_data',
'field' => 'name',
'validate_user_argument_type' => 'uid',
'validate_user_roles' => array(
'2' => 0,
),
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
'default_options_div_prefix' => '',
'default_argument_fixed' => '',
'default_argument_user' => 0,
'default_argument_image_size' => '_original',
'default_argument_php' => '',
'validate_argument_node_type' => array(
'image' => 0,
'panel' => 0,
'book' => 0,
'news_article' => 0,
'page' => 0,
'story' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'3' => 0,
'2' => 0,
'1' => 0,
),
'validate_argument_type' => 'tid',
'validate_argument_transform' => 0,
'validate_user_restrict_roles' => 0,
'validate_argument_node_flag_name' => '*relationship*',
'validate_argument_node_flag_test' => 'flaggable',
'validate_argument_node_flag_id_type' => 'id',
'validate_argument_user_flag_name' => '*relationship*',
'validate_argument_user_flag_test' => 'flaggable',
'validate_argument_user_flag_id_type' => 'id',
'image_size' => array(
'_original' => '_original',
'thumbnail' => 'thumbnail',
'preview' => 'preview',
),
'validate_argument_php' => '',
),
'name_2' => array(
'default_action' => 'ignore',
'style_plugin' => 'default_summary',
'style_options' => array(),
'wildcard' => 'all',
'wildcard_substitution' => 'All',
'title' => '',
'breadcrumb' => '',
'default_argument_type' => 'fixed',
'default_argument' => '',
'validate_type' => 'none',
'validate_fail' => 'not found',
'glossary' => 0,
'limit' => '0',
'case' => 'none',
'path_case' => 'none',
'transform_dash' => 0,
'add_table' => 0,
'require_value' => 0,
'id' => 'name_2',
'table' => 'term_data',
'field' => 'name',
'validate_user_argument_type' => 'uid',
'validate_user_roles' => array(
'2' => 0,
),
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
'default_options_div_prefix' => '',
'default_argument_fixed' => '',
'default_argument_user' => 0,
'default_argument_image_size' => '_original',
'default_argument_php' => '',
'validate_argument_node_type' => array(
'image' => 0,
'panel' => 0,
'book' => 0,
'news_article' => 0,
'page' => 0,
'story' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'3' => 0,
'2' => 0,
'1' => 0,
),
'validate_argument_type' => 'tid',
'validate_argument_transform' => 0,
'validate_user_restrict_roles' => 0,
'validate_argument_node_flag_name' => '*relationship*',
'validate_argument_node_flag_test' => 'flaggable',
'validate_argument_node_flag_id_type' => 'id',
'validate_argument_user_flag_name' => '*relationship*',
'validate_argument_user_flag_test' => 'flaggable',
'validate_argument_user_flag_id_type' => 'id',
'image_size' => array(
'_original' => '_original',
'thumbnail' => 'thumbnail',
'preview' => 'preview',
),
'validate_argument_php' => '',
),
));
$handler->override_option('filters', array(
'status_extra' => array(
'id' => 'status_extra',
'table' => 'node',
'field' => 'status_extra',
),
'type' => array(
'operator' => 'in',
'value' => array(
'news_article' => 'news_article',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
));
$handler->override_option('use_ajax', TRUE);
$handler->override_option('items_per_page', 5);
$handler->override_option('offset', 1);
$handler->override_option('use_pager', '1');
$handler->override_option('row_options', array(
'inline' => array(
'tid' => 'tid',
'title' => 'title',
),
'separator' => ' -- ',
'hide_empty' => 0,
));
$handler->override_option('pane_title', '');
$handler->override_option('pane_description', '');
$handler->override_option('pane_category', array(
'name' => 'View panes',
'weight' => 0,
));
$handler->override_option('allow', array(
'use_pager' => FALSE,
'items_per_page' => FALSE,
'offset' => FALSE,
'link_to_view' => FALSE,
'more_link' => FALSE,
'path_override' => FALSE,
'title_override' => FALSE,
'exposed_form' => FALSE,
));
$handler->override_option('argument_input', array(
'name' => array(
'type' => 'panel',
'context' => 'token.site-mail',
'context_optional' => 0,
'panel' => '0',
'fixed' => 'General Interest',
'label' => 'Taxonomy: Term',
),
'name_1' => array(
'type' => 'panel',
'context' => 'token.site-mail',
'context_optional' => 0,
'panel' => '1',
'fixed' => '',
'label' => 'Taxonomy: Term',
),
'name_2' => array(
'type' => 'fixed',
'context' => 'token.site-mail',
'context_optional' => 0,
'panel' => '0',
'fixed' => 'General Interest',
'label' => 'Taxonomy: Term',
),
));
$handler->override_option('link_to_view', 0);
$handler->override_option('inherit_panels_path', 0);
-----
What it looks like to me is that in the array of args #1 and 3 have fixed set to "General Interest" (I used crime in my example, but with either output is the same), but arg 3 should be the only one with the "fixed" option set. The other 2 should just be type panel (which they are) but with no "fixed" parameter. Am I close?
Comment #3
dawehnerEven you don't understand this we know what you are doing wrong here :)
You have the filter:
I suggest to use
There you select "is one of" as operator. That's it.
Comment #4
fblevins commentedThanks for your help. I really thought that using term names as args and term id as filter would work. Unfortunately I'm still getting the same results (i.e. if I run the view without entering arguments I get all nodes for the term id filter, but as soon as I specify arguments everything is gone.
Here's what I did: 1) removed the 3rd arg that had the fixed argument text, 2) removed the filter for taxonomy name and added one for taxonomy id set to "one of"/category. Ran the view and got the above. I also set up a test view stripped down to just the essential elements and got the same result. I sent the export in a text file this time so it wouldn't eat up as much screen.
Comment #5
fblevins commentedHad a heckuva time getting this to work. Even going so far as firing up phpMyAdmin, designing a custom query that gave the results I needed then trying to "reverse-engineer" that through views settings to replicate the query I built. No luck. Finally, and this is what, combined with the above advice, will get you going... on both of your arguments check the box that allows multiple arguments to work together!
Thanks as always for the help! Sometimes it just takes two halves to make a whole!!!