0

I have a view that returns two different content types in its results. Each content type needs different filters, so I group them using OR and AND. See below:

This view represents a category page and filters the results using a contextual filter. Both content types share the same category field. However, the contextual filter (a taxonomy term based on the URL) only applies to the first group of filters before the "OR". This shows up in the query it generates:

SELECT DISTINCT node.nid AS nid, node.created AS node_created, node.title AS node_title, node.sticky AS node_sticky, node.nid AS node_nid, 'node' AS field_data_field_image_node_entity_type, 'node' AS field_data_field_duration_node_entity_type, 'node' AS field_data_field_slug_node_entity_type, 'node' AS field_data_field_stickybit_expiretime_node_entity_type, 'node' AS field_data_field_ribbon_color_node_entity_type, 'node' AS field_data_field_ribbon_text_node_entity_type, 'node' AS field_data_field_blog_thumbnail_node_entity_type
FROM 
{node} node
LEFT JOIN {field_data_field_segment} field_data_field_segment ON node.nid = field_data_field_segment.entity_id AND (field_data_field_segment.entity_type = 'node' AND field_data_field_segment.deleted = '0')
LEFT JOIN {field_data_field_submitted} field_data_field_submitted ON node.nid = field_data_field_submitted.entity_id AND (field_data_field_submitted.entity_type = 'node' AND field_data_field_submitted.deleted = '0')
WHERE (( (node.type IN  ('story')) AND (node.status = '1')
        AND (field_data_field_segment.field_segment_value IS NULL )
        AND (field_data_field_submitted.field_submitted_value NOT IN  ('2'))
        AND (node.nid IN 
          (SELECT tn.nid AS nid FROM {taxonomy_index} tn
          LEFT OUTER JOIN {taxonomy_term_hierarchy} th ON th.tid = tn.tid
          LEFT OUTER JOIN {taxonomy_term_hierarchy} th1 ON th.parent = th1.tid
          LEFT OUTER JOIN {taxonomy_term_hierarchy} th2 ON th1.parent = th2.tid
          LEFT OUTER JOIN {taxonomy_term_hierarchy} th3 ON th2.parent = th3.tid
          LEFT OUTER JOIN {taxonomy_term_hierarchy} th4 ON th3.parent = th4.tid
          LEFT OUTER JOIN {taxonomy_term_hierarchy} th5 ON th4.parent = th5.tid
          LEFT OUTER JOIN {taxonomy_term_hierarchy} th6 ON th5.parent = th6.tid
          LEFT OUTER JOIN {taxonomy_term_hierarchy} th7 ON th6.parent = th7.tid
          LEFT OUTER JOIN {taxonomy_term_hierarchy} th8 ON th7.parent = th8.tid
          LEFT OUTER JOIN {taxonomy_term_hierarchy} th9 ON th8.parent = th9.tid
          LEFT OUTER JOIN {taxonomy_term_hierarchy} th10 ON th9.parent = th10.tid
          WHERE ( (tn.tid = '205') OR (th1.tid = '205') OR (th2.tid = '205')
            OR (th3.tid = '205') OR (th4.tid = '205') OR (th5.tid = '205')
            OR (th6.tid = '205') OR (th7.tid = '205') OR (th8.tid = '205')
            OR (th9.tid = '205') OR (th10.tid = '205') )
        ))
      )
      OR ( (node.type IN  ('blog')) AND (node.status = '1') ))
ORDER BY node_sticky DESC, node_created DESC, node_nid DESC
LIMIT 12 OFFSET 0

You can see that the contextual filter is applied only to the first group, not both. Is there any way to get the contextual filter to apply to both?

Drupal 7.8  
Views 7.x-3.0-rc1  
Views UI 7.x-3.0-rc1
2
  • 1
    My initial reaction to any bug in outdated modules is to update the modules. Did you try it? Drupal, CTools and Views have progresses since those releases. Commented Mar 19, 2014 at 21:08
  • That's something I thought of and upgrading all of this is in the roadmap for us. But we aren't ready for that right now. Can anyone confirm that this is fixed in later versions?
    – donut
    Commented Mar 20, 2014 at 20:51

1 Answer 1

0

Updating Drupal to 7.28 and the Views module to 7.x-3.7 solved the problem, as barraponto suggested it might.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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