2

I have a view that receives some arguments from a questionnaire. In the questionnaire I calculate a list of nodes that's sorted by how well they correlate with the questionnaire. Once my view receives these arguments it will just sort them by their node id, and not the custom ordering I already applied when sending the arguments.

Is there any module that will display my nodes in a view, in the same order the arguments are received from the previous page?

I already tried views_arguments_extra, but this cannot achieve what I'm trying to do.

An example:

in my questionnaire I have determined that the 5 following nodes have the highest correlation:

7: 86%
8: 83%
12: 82%
1: 80%
2: 79%

I will then send this top 5 as an argument to my view.

So I also want my view to have that order:

7 
8
12
1
2
2

I dont know of anyway to sort a view buy the arguments it receives. So this may not be really what your looking for but currently there's no other answers here and hopefully one of these alternative suggestions will help you.

Suggestion 1)

On your questionnaire submit function use views_get_view_result http://api.drupal.org/api/views/views.module/function/views_get_view_result/7 send the arguments to your view as normal you'll get back your 5 top hits but not sorted correctly. You can then reorder the results and manipulate the order the results appear in and print out your manipulated view.

Suggestion 2)

Using Views PHP module http://drupal.org/project/views_php you can create your own sorting with php. You can pass your view the data you need with url's or $_POST get that data in your view and create the sorting using that.

In a nut shell, I dont know how to do what you want, heres a couple of avenues I would probably try..

  • Thank you very much :) I did some thinking, I will probably be rendering the nodes on a page myself if your suggestions do not work. – Simon Verbeke Jul 13 '12 at 8:41
0

The module that does this very thing is Views argument sort which now lives in Views argument extras.

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.