0

I have two content types: Item and Order.

There is a link from Order -> Item through field_items.

I have a view showing content of type Item and any related order data in a table. I have set up a non-required relationship to Content using field_items to reference the Items.

I have a filter on the view to ensure that the content type on this relationship = Order. This is because I have another content type which is not shown on this view that uses field_items.

The view functions largely as required. However, it only shows Items that are linked to an order via field_items whereas I would also like it to show items for which this link doesn't yet exist.

I have tried adding a second condition for content type on the relationship is EMPTY and putting the two filters into a filter group with the OR operator. However, when I do this, nothing shows up in the view.

How do I get the view to show all Items (linked or not) with linked Order data where this exists?

0

This looks like the answer:

https://www.drupal.org/project/drupal/issues/2744777

There is a known bug in Drupal 8 whereby filter groups in views are not saved. The two filters (content type is empty and content type) Order are being AND-ed rather than OR-ed so therefore nothing is displayed as content type cannot both be empty and = Order.

0

This looks like the answer:

https://www.drupal.org/project/drupal/issues/2744777

There is a known bug in Drupal 8 whereby filter groups in views are not saved. The two filters (content type is empty and content type) Order are being AND-ed rather than OR-ed so therefore nothing is displayed as content type cannot both be empty and = Order.

The issue arises because I am using the same field to reference Items from both Order and from Batch, and using both links on the same view. Without any filters, the view displays the details of the first matched record for each Item. Where an Order exist, the order is chosen but where no order exists, the Batch will be displayed instead.

Until filter groups are working in D8, I've resolved this by creating a second entity reference field which I use to store the link from Order to Items. Now I have two fields (field_items and field_allocated_items) as follows:

Batch -> Items via field_items Order -> Items via field_allocated_items

Therefore, no filter is needed and the view displays as expected.

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.