0

On my site I want to define tutorials. One tutorial consists of several nodes of the same Tutorial content type. The content type has a field taxonomy term reference and a weight, to determine the sort order.

My idea was to have a single view, selecting on Tutorial content type, ordering by weight, one node per page. So far this works. But to only show nodes for one specific tutorial I defined a contextual filter, on the tutorial field. Now only nodes for that specific tutorial are shown, as expected, but this also has the effect that:

  • The nodes are no longer sorted by weight.
  • I no longer have one node per page

I've been looking for workarounds, different settings, etc., so far to no available , so help would be greatly appreciated.

If this is a behavior of views that can't be helped, any other approaches to my use case would also be met with immediate gratitude.

Using: Drupal 7.39, Views 7.x-3.11

1

I tried your example (with Drupal 7.39 and Views 7.x.3.11) and was not able to reproduce the issue. In short, I followed the following steps:

  • Created a taxonomy vocabulary, called "Tutorial Vocabulary"
  • Created a content type, called "Tutorial Type" containing two additional fields:

    1. "Tutorial term" (Entity Reference to Taxonomy Terms of type "Tutorial Vocabulary") and
    2. "Weight" (Integer).
  • Created some content.
  • Created a View for "Content" type "Tutorial type", added the "sorted by Weight" criterium, removed the default "sorted by creation date" criterium, and configured the default pager to display only "1 item"
  • Created a contextual filter for the "Tutorial term" field, specifying "Show page not found" when the filter value is not in the URL, and leaving everything by default.

The contextual filter seems to work as expected when I pass the tid of the taxonomy terms: Only the nodes associated to a term are displayed, they are sorted by weight, and only one node per page.

Maybe you are following different steps from the ones I am listing above. If so, please edit your post to specify them, it might be useful in order to find a solution to your question.

2
  • Hi dinopmi, I'd like to thank you for your help in resolving this issue for me. I followed your steps and recreated everything in parallel to what I already had, and it worked. I then set about trying to find out why my old solution didn't. After some experimenting it finally hit me. My view and my vocabulary had the same name. So when I wanted to see my tutorial view (tutorial/tutorial1) I, in fact, got everything on taxonomy term tutorial/tutorial1, but didn't realize this. – tassaert.l Oct 14 '15 at 12:33
  • Hi tassaert.l Glad of having been of any help! – dinopmi Oct 14 '15 at 14:59

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.