I am using Taxonomy Term Name as an argument for a view and it works just as expected without any exposed filters set. It will filter by term name through the url, but if I try to then filter this new list by an exposed filter I get an empty result back, eg www.website.com/node/$arg?filter0=1. I tried all combinations of exposed filters and nothing worked. Here is an export of the view:

   $view = new stdClass();
  $view->name = 'images';
  $view->description = 'This view is for displaying images.';
  $view->access = array (
);
  $view->page = TRUE;
  $view->page_title = 'Images';
  $view->page_header = '';
  $view->page_header_format = '1';
  $view->page_footer = '';
  $view->page_footer_format = '1';
  $view->page_empty = '';
  $view->page_empty_format = '1';
  $view->page_type = 'bonus_grid';
  $view->url = 'media/images';
  $view->use_pager = TRUE;
  $view->nodes_per_page = '16';
  $view->sort = array (
    array (
      'tablename' => 'search_index',
      'field' => 'score',
      'sortorder' => 'DESC',
      'options' => '',
    ),
    array (
      'tablename' => 'node',
      'field' => 'created',
      'sortorder' => 'DESC',
      'options' => 'normal',
    ),
    array (
      'tablename' => 'node',
      'field' => 'title',
      'sortorder' => 'ASC',
      'options' => '',
    ),
  );
  $view->argument = array (
    array (
      'type' => 'taxletter',
      'argdefault' => '2',
      'title' => '%1 Images',
      'options' => '',
      'wildcard' => '*',
      'wildcard_substitution' => '',
    ),
  );
  $view->field = array (
    array (
      'tablename' => 'node_data_field_imagefield',
      'field' => 'field_imagefield_fid',
      'label' => '',
      'handler' => 'content_views_field_handler_group',
      'options' => 'lightbox2][thumbnail][preview',
    ),
  );
  $view->filter = array (
    array (
      'tablename' => 'node',
      'field' => 'status',
      'operator' => '=',
      'options' => '',
      'value' => '1',
    ),
    array (
      'tablename' => 'node',
      'field' => 'type',
      'operator' => 'OR',
      'options' => '',
      'value' => array (
  0 => 'image',
),
    ),
    array (
      'tablename' => 'term_node_3',
      'field' => 'tid',
      'operator' => 'OR',
      'options' => '',
      'value' => array (
  0 => '5',
  1 => '4',
  2 => '1000048',
),
    ),
    array (
      'tablename' => 'node',
      'field' => 'distinct',
      'operator' => '=',
      'options' => '',
      'value' => array (
  0 => 'distinct',
),
    ),
    array (
      'tablename' => 'temp_search_results',
      'field' => 'word',
      'operator' => '=',
      'options' => '',
      'value' => '',
    ),
  );
  $view->exposed_filter = array (
    array (
      'tablename' => 'temp_search_results',
      'field' => 'word',
      'label' => 'Search',
      'optional' => '1',
      'is_default' => '0',
      'operator' => '1',
      'single' => '0',
    ),
    array (
      'tablename' => 'term_node_3',
      'field' => 'tid',
      'label' => '',
      'optional' => '1',
      'is_default' => '1',
      'operator' => '1',
      'single' => '0',
    ),
  );
  $view->requires = array(search_index, node, node_data_field_imagefield, term_node_3, temp_search_results);
  $views[$view->name] = $view; 

And the query from Dev Query :

SELECT DISTINCT(node.nid), node.created AS node_created_created, node.title AS node_title, node_data_field_imagefield.field_imagefield_fid AS node_data_field_imagefield_field_imagefield_fid, node_data_field_imagefield.field_imagefield_title AS node_data_field_imagefield_field_imagefield_title, node_data_field_imagefield.field_imagefield_alt AS node_data_field_imagefield_field_imagefield_alt 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 {content_type_image} node_data_field_imagefield ON node.vid = node_data_field_imagefield.vid WHERE (%s.%s %s '%s') AND (%s.%s IN ('%s')) AND (term_node.tid IN ('5','4','1000048')) GROUP BY node.nid, node_created_created, node_title ORDER BY node_created_created DESC, node_title ASC

Comments

Kripsy’s picture

Something I just noticed worth mentioning, if I enable Views Save Filter and then repeat the process above with some options on a multi-select exposed filter selected I get the blank query as expected. But then if I remove all of the checkboxes so that the url shows www.website.com/node/$arg?filter0= instead of www.website.com/node/$arg?filter0=1&filter1=3D, Views Save Filter remembers my selections and defaults them and I get a query back with the proper filtering. I'm pretty sure this has something to do with the argument handling and not the URL though because I tried embedding a view with a hard coded argument instead of having it passed through the URL and I had the same results using exposed filters.

Kripsy’s picture

Title: Views URL Argument Returns No Results With Exposed Filter » Using An Argument With Exposed Filters Returns No Results

I confirmed this with a fresh local install. I set up a view that gave a list view of all Story nodes which had two vocabularies enabled. The view had Term Name argument enabled and vocab 2 exposed. If I sent an argument to filter the nodes by vocab 1 it worked as expected. If I then tried to further filter results with the exposed filter I got no results in return, unexpected.

PeterZ’s picture

I had the same problem.

What I did is go into views.module and in the views_build_view function replace:
$view->real_url = views_get_url($view, $args);

with:
$view->real_url = $view->url . "/all";

This doesn't seem like a good change (I'm not a developer) but it is working for my implementation.

Perhaps this can point someone more knowledgeable in the right direction.

socialnicheguru’s picture

I was able to find a solution in another thread.

My issue was with Views Filter Block

solution in views_filterblock.module

// Views filter block erases arguments
// change function
// http://drupal.org/node/112552#comment-796805
// Change action line
// http://drupal.org/node/112552#comment-823797

function views_filterblock($view) {
$action = (substr($_GET['q'], 0, strlen($view->url)) == $view->url) ? $_GET[q]\
: $view->url;

$form = views_filters($view);
$form['#action'] = url($action);
$form['#views_filterblock'] = true;
return $form;
}

tisho-1’s picture

Hi,

I have the same problem, where I am using Taxonomy Menu (it feeds my view with a vocabulary and term arguments), Clean URLs and Views exposed filters to create a local list of businesses.

Do you have any idea if (how) can this solution be applied to the Views module?

Thanks in advance!

md2’s picture

I have the same issue as the original post.

The fix in #3 did not work for me.
The other fixes proposed in this tread seem to be for views_filterblock.module which I am not using.

Does anyone know how to fix the issue if only usign views and taxonomy?

Any helps greatly appreciated!

Thanks

mstef’s picture

I think my issue is the same - you can decide:

Using Panels3 to override taxonomy term pages. Created a view that takes the term ID as an argument. Has a number of exposed filters - all optional. When you visit the tax term page you get an empty text result. But then if you press "Apply" to the filters, without changing any of them from the default [any] selection - the nodes show.

I find this to be a huge issue.

mstef’s picture

{edit out}

esmerel’s picture

Status: Active » Closed (fixed)

Given the age of this issue, I have to presume it's either figured out or no longer relevant.

alanpeart’s picture

I have the same issue. Combining a taxonomy argument from one vocabulary with exposed filters from another vocabulary doesn't work. The generated SQL is incorrect. It tries to match both terms using the same joined table (it should use a different join on the same table using a second alias).

oriolbel’s picture

Status: Closed (fixed) » Active

Having the same issue, The view receives taxonomy argument and another taxonomy vocabulary exposed filter. The same as written above when I submit the exposed form, there're no view results. (Using Views 6.x-2.12)

This is the view query:
SELECT DISTINCT(node.nid) AS nid, node.changed AS node_changed
FROM node node LEFT JOIN term_node term_node_value_0 ON node.vid = term_node_value_0.vid AND term_node_value_0.tid = 16 INNER JOIN term_data term_data ON term_node_value_0.tid = term_data.tid
WHERE (node.type in ('TYPE')) AND (node.status <> 0) AND (term_data.name = 'TERM_NAME')
GROUP BY nid
ORDER BY node_changed DESC

R.Hendel’s picture

Version: 5.x-1.x-dev » 6.x-2.12
Status: Active » Fixed

Thanks for your posting.
We need more information on this to reproduce this problem. Because this issue is very old I will fix it.
Please feel free to reopen it, if you have more informations.
Otherwise, it will closed automatically for two weeks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.