0

I've got View of Product Displays, each Product Display are referencing 1-4 Products. Each Product are tagged with a Taxonomy Term (attributes).

When I create an Exposed Filter on the Terms it's only scanning the first Product referenced by each Product Display making each Product Display appearing only on one of the terms in the Exposed Filter even though it may reference 3 Products with 3 different Terms. How can I make it scan all Products referenced and hereby display the correct results on my product filter?

Here's my view:

$view = new view();
$view->name = 'releases';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Releases';
$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['title'] = 'New Releases';
$handler->display->display_options['use_ajax'] = TRUE;
$handler->display->display_options['use_more'] = TRUE;
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['use_more_text'] = 'All releases';
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'better_exposed_filters';
$handler->display->display_options['exposed_form']['options']['expose_sort_order'] = FALSE;
$handler->display->display_options['exposed_form']['options']['autosubmit'] = TRUE;
$handler->display->display_options['exposed_form']['options']['bef'] = array(
  'general' => array(
    'allow_secondary' => 0,
    'secondary_label' => 'Advanced options',
    'collapsible_label' => NULL,
    'combine_rewrite' => NULL,
    'reset_label' => NULL,
  ),
  'field_format_tid' => array(
    'bef_format' => 'bef',
    'more_options' => array(
      'bef_select_all_none' => 1,
      'bef_collapsible' => 0,
      'is_secondary' => 0,
      'any_label' => '',
      'bef_filter_description' => '',
      'tokens' => array(
        'available' => array(
          0 => 'global_types',
          1 => 'vocabulary',
          'secondary_label' => NULL,
          'collapsible_label' => NULL,
          'combine_rewrite' => NULL,
          'reset_label' => NULL,
        ),
        'secondary_label' => NULL,
        'collapsible_label' => NULL,
        'combine_rewrite' => NULL,
        'reset_label' => NULL,
      ),
      'rewrite' => array(
        'filter_rewrite_values' => '',
        'secondary_label' => NULL,
        'collapsible_label' => NULL,
        'combine_rewrite' => NULL,
        'reset_label' => NULL,
      ),
      'secondary_label' => NULL,
      'collapsible_label' => NULL,
      'combine_rewrite' => NULL,
      'reset_label' => NULL,
    ),
    'secondary_label' => NULL,
    'collapsible_label' => NULL,
    'combine_rewrite' => NULL,
    'reset_label' => NULL,
  ),
  'secondary_label' => NULL,
  'collapsible_label' => NULL,
  'combine_rewrite' => NULL,
  'reset_label' => NULL,
);
$handler->display->display_options['exposed_form']['options']['input_required'] = 0;
$handler->display->display_options['exposed_form']['options']['text_input_required_format'] = 'full_html';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '4';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['pager']['options']['id'] = '0';
$handler->display->display_options['pager']['options']['total_pages'] = '3';
$handler->display->display_options['pager']['options']['quantity'] = '9';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
$handler->display->display_options['row_options']['inline'] = array(
  'field_product_artwork' => 'field_product_artwork',
  'field_related_artist' => 'field_related_artist',
  'title' => 'title',
);
/* Relationship: Content: Referenced products */
$handler->display->display_options['relationships']['field_product_reference_product_id']['id'] = 'field_product_reference_product_id';
$handler->display->display_options['relationships']['field_product_reference_product_id']['table'] = 'field_data_field_product_reference';
$handler->display->display_options['relationships']['field_product_reference_product_id']['field'] = 'field_product_reference_product_id';
$handler->display->display_options['relationships']['field_product_reference_product_id']['required'] = TRUE;
/* Field: Content: Artwork */
$handler->display->display_options['fields']['field_product_artwork']['id'] = 'field_product_artwork';
$handler->display->display_options['fields']['field_product_artwork']['table'] = 'field_data_field_product_artwork';
$handler->display->display_options['fields']['field_product_artwork']['field'] = 'field_product_artwork';
$handler->display->display_options['fields']['field_product_artwork']['label'] = '';
$handler->display->display_options['fields']['field_product_artwork']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['field_product_artwork']['click_sort_column'] = 'fid';
$handler->display->display_options['fields']['field_product_artwork']['settings'] = array(
  'image_style' => 'large',
  'image_link' => 'content',
);
/* Field: Content: Subscriptions */
$handler->display->display_options['fields']['field_artist_tags']['id'] = 'field_artist_tags';
$handler->display->display_options['fields']['field_artist_tags']['table'] = 'field_data_field_artist_tags';
$handler->display->display_options['fields']['field_artist_tags']['field'] = 'field_artist_tags';
$handler->display->display_options['fields']['field_artist_tags']['label'] = '';
$handler->display->display_options['fields']['field_artist_tags']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['field_artist_tags']['type'] = 'taxonomy_term_reference_plain';
$handler->display->display_options['fields']['field_artist_tags']['delta_offset'] = '0';
/* 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']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
/* Sort criterion: Commerce Product: Release date (field_product_release_date) */
$handler->display->display_options['sorts']['field_product_release_date_value']['id'] = 'field_product_release_date_value';
$handler->display->display_options['sorts']['field_product_release_date_value']['table'] = 'field_data_field_product_release_date';
$handler->display->display_options['sorts']['field_product_release_date_value']['field'] = 'field_product_release_date_value';
$handler->display->display_options['sorts']['field_product_release_date_value']['relationship'] = 'field_product_reference_product_id';
$handler->display->display_options['sorts']['field_product_release_date_value']['order'] = 'DESC';
/* 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;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
  'product_display' => 'product_display',
);
/* Filter criterion: Content: Product reference (field_product_reference:delta) */
$handler->display->display_options['filters']['delta']['id'] = 'delta';
$handler->display->display_options['filters']['delta']['table'] = 'field_data_field_product_reference';
$handler->display->display_options['filters']['delta']['field'] = 'delta';
$handler->display->display_options['filters']['delta']['value']['value'] = '0';
/* Filter criterion: Commerce Product: Type */
$handler->display->display_options['filters']['type_1']['id'] = 'type_1';
$handler->display->display_options['filters']['type_1']['table'] = 'commerce_product';
$handler->display->display_options['filters']['type_1']['field'] = 'type';
$handler->display->display_options['filters']['type_1']['relationship'] = 'field_product_reference_product_id';
$handler->display->display_options['filters']['type_1']['value'] = array(
  'record' => 'record',
);
/* Filter criterion: Content: Has taxonomy term */
$handler->display->display_options['filters']['tid']['id'] = 'tid';
$handler->display->display_options['filters']['tid']['table'] = 'taxonomy_index';
$handler->display->display_options['filters']['tid']['field'] = 'tid';
$handler->display->display_options['filters']['tid']['value'] = array(
  0 => '98',
);
$handler->display->display_options['filters']['tid']['expose']['operator_id'] = 'tid_op';
$handler->display->display_options['filters']['tid']['expose']['label'] = 'Has taxonomy term';
$handler->display->display_options['filters']['tid']['expose']['operator'] = 'tid_op';
$handler->display->display_options['filters']['tid']['expose']['identifier'] = 'tid';
$handler->display->display_options['filters']['tid']['expose']['required'] = TRUE;
$handler->display->display_options['filters']['tid']['expose']['remember_roles'] = array(
  2 => '2',
  1 => 0,
  3 => 0,
);
$handler->display->display_options['filters']['tid']['vocabulary'] = 'label_subscriptions';

/* Display: Releases page */
$handler = $view->new_display('block', 'Releases page', 'block');
$handler->display->display_options['defaults']['pager'] = FALSE;
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '';
$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['defaults']['filter_groups'] = FALSE;
$handler->display->display_options['defaults']['filters'] = FALSE;
/* 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;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
  'product_display' => 'product_display',
);
/* Filter criterion: Content: Product reference (field_product_reference:delta) */
$handler->display->display_options['filters']['delta']['id'] = 'delta';
$handler->display->display_options['filters']['delta']['table'] = 'field_data_field_product_reference';
$handler->display->display_options['filters']['delta']['field'] = 'delta';
$handler->display->display_options['filters']['delta']['value']['value'] = '0';
/* Filter criterion: Commerce Product: Type */
$handler->display->display_options['filters']['type_1']['id'] = 'type_1';
$handler->display->display_options['filters']['type_1']['table'] = 'commerce_product';
$handler->display->display_options['filters']['type_1']['field'] = 'type';
$handler->display->display_options['filters']['type_1']['relationship'] = 'field_product_reference_product_id';
$handler->display->display_options['filters']['type_1']['value'] = array(
  'record' => 'record',
);
/* Filter criterion: Content: Has taxonomy term */
$handler->display->display_options['filters']['tid']['id'] = 'tid';
$handler->display->display_options['filters']['tid']['table'] = 'taxonomy_index';
$handler->display->display_options['filters']['tid']['field'] = 'tid';
$handler->display->display_options['filters']['tid']['value'] = array(
  0 => '98',
);
$handler->display->display_options['filters']['tid']['expose']['operator_id'] = 'tid_op';
$handler->display->display_options['filters']['tid']['expose']['label'] = 'Has taxonomy term';
$handler->display->display_options['filters']['tid']['expose']['operator'] = 'tid_op';
$handler->display->display_options['filters']['tid']['expose']['identifier'] = 'tid';
$handler->display->display_options['filters']['tid']['expose']['required'] = TRUE;
$handler->display->display_options['filters']['tid']['expose']['remember_roles'] = array(
  2 => '2',
  1 => 0,
  3 => 0,
);
$handler->display->display_options['filters']['tid']['vocabulary'] = 'label_subscriptions';
/* Filter criterion: Commerce Product: Format (field_format) */
$handler->display->display_options['filters']['field_format_tid']['id'] = 'field_format_tid';
$handler->display->display_options['filters']['field_format_tid']['table'] = 'field_data_field_format';
$handler->display->display_options['filters']['field_format_tid']['field'] = 'field_format_tid';
$handler->display->display_options['filters']['field_format_tid']['relationship'] = 'field_product_reference_product_id';
$handler->display->display_options['filters']['field_format_tid']['value'] = array(
  16 => '16',
  14 => '14',
  15 => '15',
  21 => '21',
  40 => '40',
);
$handler->display->display_options['filters']['field_format_tid']['exposed'] = TRUE;
$handler->display->display_options['filters']['field_format_tid']['expose']['operator_id'] = 'field_format_tid_op';
$handler->display->display_options['filters']['field_format_tid']['expose']['label'] = 'Filter by format';
$handler->display->display_options['filters']['field_format_tid']['expose']['operator'] = 'field_format_tid_op';
$handler->display->display_options['filters']['field_format_tid']['expose']['identifier'] = 'field_format_tid';
$handler->display->display_options['filters']['field_format_tid']['expose']['multiple'] = TRUE;
$handler->display->display_options['filters']['field_format_tid']['expose']['remember_roles'] = array(
  2 => '2',
  1 => 0,
  3 => 0,
  7 => 0,
  8 => 0,
);
$handler->display->display_options['filters']['field_format_tid']['expose']['reduce'] = TRUE;
$handler->display->display_options['filters']['field_format_tid']['type'] = 'select';
$handler->display->display_options['filters']['field_format_tid']['vocabulary'] = 'shop_format';

/* Display: New releases (home) */
$handler = $view->new_display('block', 'New releases (home)', 'block_1');
1

The reason it's only matching against terms from the first referenced product is because you restrict query results to just that product when you added the Content: Product reference (field_product_reference:delta) filter. This is limiting query results to just the rows where the referenced product delta is 0 (i.e. the first referenced product).

What you'll need it to figure out how to do is not restrict the query result set (i.e. get rid of that delta filter) but still maintain the look you want when the View is rendered. I can't say for sure this is a good lead, but you might look into grouping the results by node ID if that's possible.

  • 1
    Great! Solved by removing the filter and going to Other > Query and ticking 'strict' – Kristoffer Rom Sep 8 '15 at 16:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.