The schema is nodes with a Node Reference to a table Area, this ones has a NR to Cities and this one to States. I have a View with a Hierarchical Select Node Reference filter to filter the nodes by location. (Properties -> State -> City -> Area). In properties, for the the node reference I'm using a Hierarchical Select with 3 values, and saving the lineage.

It works if I choose the state (provincia), the city (municipio) and the area (zona), or if I select in state, but when I'm only selecting State, or State and City, the result is empty. There should be a option in every select. I have checked Optional in the filter.

Can anyone help please?

This is the view exported:

$view = new view;
$view->name = 'filtro_inmuebles';
$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('relationships', array(
  'field_localizacion_inmueble_nid' => array(
    'label' => 'Zona',
    'required' => 0,
    'delta' => '-1',
    'id' => 'field_localizacion_inmueble_nid',
    'table' => 'node_data_field_localizacion_inmueble',
    'field' => 'field_localizacion_inmueble_nid',
    'relationship' => 'none',
  ),
  'field_municipio_zona_nid' => array(
    'label' => 'Municipio',
    'required' => 1,
    'delta' => '-1',
    'id' => 'field_municipio_zona_nid',
    'table' => 'node_data_field_municipio_zona',
    'field' => 'field_municipio_zona_nid',
    'relationship' => 'field_localizacion_inmueble_nid',
  ),
  'field_provincia_municipio_nid' => array(
    'label' => 'Provincia',
    'required' => 1,
    'delta' => -1,
    'id' => 'field_provincia_municipio_nid',
    'table' => 'node_data_field_provincia_municipio',
    'field' => 'field_provincia_municipio_nid',
    'relationship' => 'field_municipio_zona_nid',
  ),
));
$handler->override_option('fields', array(
  'title' => array(
    'label' => 'Nombre del Inmueble',
    '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',
  ),
  'title_3' => array(
    'label' => 'Zona',
    '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' => 'title_3',
    'table' => 'node',
    'field' => 'title',
    'relationship' => 'field_localizacion_inmueble_nid',
  ),
  'title_1' => array(
    'label' => 'Municipio',
    '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' => 'title_1',
    'table' => 'node',
    'field' => 'title',
    'relationship' => 'field_municipio_zona_nid',
  ),
  'title_2' => array(
    'label' => 'Provincia',
    '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' => 'title_2',
    'table' => 'node',
    'field' => 'title',
    'relationship' => 'field_provincia_municipio_nid',
  ),
  'field_localizacion_inmueble_nid' => array(
    'label' => 'Localización',
    '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,
    'label_type' => 'widget',
    'format' => 'plain',
    'multiple' => array(
      'group' => 1,
      'multiple_number' => '3',
      'multiple_from' => '0',
      'multiple_reversed' => 0,
    ),
    'exclude' => 0,
    'id' => 'field_localizacion_inmueble_nid',
    'table' => 'node_data_field_localizacion_inmueble',
    'field' => 'field_localizacion_inmueble_nid',
    'relationship' => 'none',
  ),
));
$handler->override_option('filters', array(
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'inmuebles' => 'inmuebles',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'relationship' => 'none',
  ),
  'field_localizacion_inmueble_nid' => array(
    'operator' => 'or',
    'value' => array(),
    'group' => '0',
    'exposed' => TRUE,
    'expose' => array(
      'use_operator' => 0,
      'operator' => 'field_localizacion_inmueble_nid_op',
      'identifier' => 'field_localizacion_inmueble_nid',
      'label' => 'Localización',
      'bef_filter_description' => '',
      'bef_format' => 'default',
      'optional' => 0,
      'remember' => 0,
      'reduce' => 0,
      'bef_select_all_none' => 0,
    ),
    'type' => 'hierarchical_select',
    'nodereference_path' => 'inmuebles.field_localizacion_inmueble-zonas.field_municipio_zona-municipios.field_provincia_municipio',
    'content_type' => 'inmuebles',
    'id' => 'field_localizacion_inmueble_nid',
    'table' => 'node_data_field_localizacion_inmueble',
    'field' => 'field_localizacion_inmueble_nid',
    'configure_hs' => '<a href="/espasol/admin/build/views/hs_config_nodereference/filtro_inmuebles/default/field_localizacion_inmueble_nid">Configure Hierarchical Select</a>',
    'relationship' => 'none',
    'reduce_duplicates' => 0,
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('cache', array(
  'type' => 'none',
));
$handler->override_option('use_ajax', TRUE);
$handler->override_option('use_pager', '1');
$handler->override_option('distinct', 0);
$handler->override_option('style_plugin', 'table');
$handler->override_option('style_options', array(
  'grouping' => '',
  'override' => 1,
  'sticky' => 0,
  'order' => 'asc',
  'columns' => array(
    'title' => 'title',
    'title_1' => 'title_1',
    'title_2' => 'title_2',
  ),
  'info' => array(
    'title' => array(
      'sortable' => 0,
      'separator' => '',
    ),
    'title_1' => array(
      'sortable' => 0,
      'separator' => '',
    ),
    'title_2' => array(
      'sortable' => 0,
      'separator' => '',
    ),
  ),
  'default' => '-1',
));

Comments

taote’s picture

Category: bug » support
Status: Active » Closed (fixed)

I solved it. Sorry it was my mistake, I had to click on settings in the filter, and then on Configure Hierarchical Select and then select 'Allow the user to choose a nodo from any level', doing that I can filter by any level.