When VFP is enabled if I make a simple exposed filter (Node type) and use the standard box I get a list of nodes when viewing the filter page, but when I choose an option and hit filter no results are shown. When VFP is disabled filtering works fine.

Comments

peter-boeren’s picture

portulaca,

thanks for testing. Could you attach a screenshot and maybe a export of your view?

portulaca’s picture

StatusFileSize
new19.01 KB
new22.64 KB

Here is the export

$view = new view;
$view->name = 'vef_test';
$view->description = '';
$view->tag = '';
$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(
  'title' => array(
    'label' => 'Title',
    '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,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_node' => 1,
    'exclude' => 0,
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'relationship' => 'none',
  ),
  'type' => array(
    'label' => 'Type',
    '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,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_node' => 0,
    'exclude' => 0,
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'relationship' => 'none',
  ),
));
$handler->override_option('filters', array(
  'type' => array(
    'operator' => 'in',
    'value' => array(),
    'group' => '0',
    'exposed' => TRUE,
    'expose' => array(
      'use_operator' => 0,
      'operator' => 'type_op',
      'identifier' => 'type',
      'label' => 'Node: Type',
      'optional' => 1,
      'single' => 0,
      'remember' => 0,
      'reduce' => 0,
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'relationship' => 'none',
    'views_filter_pack_element_type' => NULL,
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('cache', array(
  'type' => 'none',
));

It's a very simple view that exposes filter for Node type, and shows fields Node Title and Node Type.

You can see in the first screenshot that Select box (original) is chosen. And on the bottom you see results of the filter, note it found some Book pages. Here is the query since you don't see it in the screenshot:

SELECT node.nid AS nid,
   node.title AS node_title,
   node.type AS node_type
 FROM node node 
    

The second screenshot shows what happens after you choose Book page and filter, there are no results (the same with any other content type). You can also see the query there.

justindodge’s picture

I'm having a similar issue, but it would more accurately be described as "view breaks when using exposed filters and taxonomy arguments with multiple terms per argument". The summary is that the function _views_filter_pack_clean_args() seems to screw up the placeholders for the where clause in the query.

Here are the args I'm passing into the view:
args = Array [3]
0 = (string:9) 1606+1501
1 = (string:3) 152
2 = (string:3) 319

Here is $view->query->where (before _views_filter_pack_clean_args)
args = Array [6]
0 = (string:7) acclaim
1 = (int) 1606
2 = (int) 1501
3 = (int) 152
4 = (int) 319
5 = (string:2) 16
clauses = Array [6]
0 = (string:19) node.type in ('%s')
1 = (string:16) node.status <> 0
2 = (string:25) term_node.tid IN (%d, %d)
3 = (string:26) term_node_value_0.tid = %d
4 = (string:26) term_node_value_1.tid = %d
5 = (string:19) term_data2.vid = %d

And here it is after:
args = Array [4]
0 = (string:7) acclaim
3 = (int) 152
4 = (int) 319
5 = (string:2) 16
clauses = Array [6]
0 = (string:19) node.type in ('%s')
1 = (string:16) node.status <> 0
2 = (string:25) term_node.tid IN (%d, %d)
3 = (string:26) term_node_value_0.tid = %d
4 = (string:26) term_node_value_1.tid = %d
5 = (string:19) term_data2.vid = %d

You can see that args[1] and args[2] from the pre cleaned version of the variable have been eliminated. When the query is formed, as you might expect, the wrong values are substituted in the wrong placeholders.

This seems to be a result of using the "+" operator in the args (by the way, I'm using a taxonomy term id argument in the view with the option "Allow multiple terms per argument").

If I do not use multiple terms per argument, the view works fine. Here is an example of a set of args that work fine:
args = Array [3]
0 = (string:9) 1501
1 = (string:3) 152
2 = (string:3) 319

Note that args[0] only has a single value and no "+".

Hope that's helpful.

peter-boeren’s picture

portulaca,

thanks for the exposed views.

@justindodge: I think you analysis is helpful. You are also one of the first who have tried to understand my code. Especially thanks for the addition of "multiple terms per argument" because I was missing that part of the puzzle and therefore I had a hard time to reproduce it. Sometimes the options of views are overwhelming.

zhulikas’s picture

StatusFileSize
new62.44 KB

So... Any progress solving this problem?
I have the same problem.
Then I enable VFP and choose non-default (radio buttons or check boxes) display of an exposed filter, I get an error.

Error code is attached to this issue.

This is my views code:

$view = new view;
$view->name = 'cms_list';
$view->description = 'List of specific CMS.';
$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(
  'title' => array(
    'label' => 'Title',
    '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,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_node' => 1,
    'exclude' => 0,
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'relationship' => 'none',
  ),
));
$handler->override_option('filters', array(
  'field_features_value_many_to_one' => array(
    'operator' => 'and',
    'value' => array(),
    'group' => '0',
    'exposed' => TRUE,
    'expose' => array(
      'use_operator' => 0,
      'operator' => 'field_features_value_many_to_one_op',
      'identifier' => 'feature',
      'label' => 'Features',
      'optional' => 1,
      'single' => 0,
      'remember' => 0,
      'reduce' => 0,
    ),
    'id' => 'field_features_value_many_to_one',
    'table' => 'node_data_field_features',
    'field' => 'field_features_value_many_to_one',
    'relationship' => 'none',
    'reduce_duplicates' => 1,
    'views_filter_pack_element_type' => 'checkboxes',
    'override' => array(
      'button' => 'Override',
    ),
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('cache', array(
  'type' => 'none',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'list');
$handler->override_option('menu', array(
  'type' => 'normal',
  'title' => 'List',
  'description' => '',
  'weight' => '0',
  'name' => 'primary-links',
));
$handler->override_option('tab_options', array(
  'type' => 'none',
  'title' => '',
  'description' => '',
  'weight' => 0,
));