0

I have a view with 2 fields, node_title and node_related_content. For the field node_related_content I use the formatter = rendered node and view mode = Preview. These rendered nodes are fetched from a multiple value field in a content type "product group" that I use for listing related products.

In the view I use a contextual filter that gives me all the node IDs that belong to this view.

Now, the view works fine for one result (one group of rendered nodes). But if I enter more than one node ID in the preview field it onlyt gives me the first group... I need to have all the products groups, not just the first one.

What do I do wrong here?

This is the resulting SQL query:

SELECT node.title AS node_title, node.nid AS nid, field_data_field_koppla_givare.delta AS field_data_field_koppla_givare_delta, field_data_field_koppla_givare.language AS field_data_field_koppla_givare_language, field_data_field_koppla_givare.bundle AS field_data_field_koppla_givare_bundle, field_data_field_koppla_givare.field_koppla_givare_nid AS field_data_field_koppla_givare_field_koppla_givare_nid, 'node' AS field_data_field_koppla_givare_node_entity_type FROM {node} node LEFT JOIN {field_data_field_koppla_givare} field_data_field_koppla_givare ON node.nid = field_data_field_koppla_givare.entity_id AND field_data_field_koppla_givare.entity_type = 'node' WHERE (( (node.nid = '26262,21888' ) )AND(( (node.status = '1') )))

So the above query only shows the rendered nodes found in the product group 26262. The product group 21888 is ignored.

UPDATE: after experimenting with the SQL query in phpmyadmin I have found out that the last row in the query should look like this:

WHERE (( (node.nid IN('26262', '21888', '21877') ) )AND(( (node.status = '1') )))

Now, how can I alter my view to reflect that change?

1

The solution was very simple, and I found it here: Views related nodes with contextual filters multiple-value handling problem

I just had to tick the "Allow multiple values" box under the More section in the contextual filter. A bit embarassing in the end... but that box was very well hidden indeed.

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.