I've tried the solutions here:

Display random value from multi-value field in Views

And here

views... two random nodes to vote on

This is what I have: A content type (Inventory) involving a field collection of up to 10 items with a picture, price, description and a link.

I have a block view created filtered by category (so it shows up when users click on a particular category and a sort filter setup to randomize.

The block view shows field collection items.. but I only want it to show field collection items for one node at a time, then randomize the results.

Currently it's showing more than one nodes' field collection items.. When I refresh the page, it does randomize the results, but it's mixing nodes and field collection items together. I just want to randomize the node. enter image description here

  • So you want to show all the field collection items for a random node that has the taxonomy term of the term page you are currently on? – rooby Feb 10 '16 at 15:02
  • Yes. I have it filtering by taxonomy. That's working as it should. now it's just to randomize the NID that has the field collection items. – Max Feb 10 '16 at 16:11
  • Update: It seems to be 100% related to the field collection. For example. I just removed all fields but NID and all relationships, set the Pager to show only one result. I refresh a couple times and a different NID shows every time, which is what I'm after. But when I start adding a relationship to include field collection items.. the behavior changes and it randomizes the field collection id's. Not the node ID.. and never shows another node.. – Max Feb 10 '16 at 19:11

You could try the Views Field View module, which allows you to have a view as a field in another view.

So you would set up your view of nodes, filtering by taxonomy term and sorting randomly. Limit this to one result.

Then add another view that just shows the field collection items with a contextual filter for the parent entity id (I can't remember right now what filter you would use).

Then add the second view as a field on the first view.

  • Perfect. Just had to filter by raw NID to get it work correctly. Thanks @rooby. – Max Feb 16 '16 at 14:10

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.