2

I want to use one common View to list Donations to each different organization (I have a lot), manageing each different View instance via contextual filters.

e.g. mysite/myView/9/2017, where :

  • 9 = Contribution Page ID (which is organization specific)
  • 2017 = Contribution Year

This works fine for filtering, but, beyond this, I would like the page Title to contain the Contribution Page Name.

I can, of course have a Title in the form of "Contributions 9" (using %1 to override the Title), but "9" does not speak a lot.

I have tried a solution, consisting in specifying the Contribution Page Name as a 3rd Contextual Filter and overriding the Page Title with this %3 filter : when I do that, the following URL mysite/myView/9/2017/"my Contribution Page" provides me with the correct title, but then, the View displays no result.

Am I missing sth ? Any help is welcome.

2 Answers 2

2
+50

I can't quite make out all your requirements from your description - but I do have an example that (possibly) comes close to this. I don't use contextual filters though - I use Exposed Filters to identify which of 150 Contribution pages - specific Donations belong to:

enter image description here

Note that the URL in this case is: /donations-via-group-contribution-pages?financial_type=All&contribution_page=43

So you could pass in that URL (or for any other contribution_page_id) -> and then have a screen for a sub-organization;

Thus far I've only used contextual filters for Drupal Commerce Views -> with a Contextual filter for Drupal userid -> so that we can then have permissions to only show Orders that belong to a specific user;

6
  • Thank you Karin : if I understand well, what I want to get in the Title, you display it as a filter value (exposed) : not a bad idea ! But what if the user resets the filter ? (+ I have several filters in my Views, which will be confusing). Anyway, however, I will dig the idea : I can, may-be, mix the 2 filters : contextual for actual filtering + exposed for the display. I keep the post open, in case other ideas occur. Nov 7, 2017 at 16:55
  • People can change/reset the contextual filter too - Nov 7, 2017 at 17:33
  • Yes, but only via the URL by hand (I only know this way), which is not intuitive. Nov 9, 2017 at 7:57
  • BTW, I don't have this generic "RESET" button in my Views (I use 7.x 3.18) (I have to reset each filter individually) : is it an option that I don't know, or do you use a different version ? Nov 9, 2017 at 8:19
  • Install the Better Exposed Filters module Nov 9, 2017 at 13:08
1

Thank you Karin, I think I have a better understanding now :

When I want to set membership_type (alpha-numeric) as a filter, Views interprets it as membership_type_id (integer) : this is the case in the URL :

If I set the alphanumeric membership_type (alphanumeric instead) (e.g. "Catéchisme" in my case), then the View is empty : thus, I can't override the View Title with this parameter.

But it is not the case for the exposed filter in the View itself which displays the alphanumeric value of membership_type (e.g. "Catéchisme" in my case), as suggested by Karin.

Finally I will set the alphanumeric membership_type as :

  • an exposed filter in the View ("Organisation" in the screen shot here under)
  • a contextual filter in the URL (with the membership_type_id integer value)
  • a display filter in the URL (also with the membership_type_id integer value)

such as : https://.../myView/56?membership_type=56

[![enter image description here][1]][1]

Doing so, if the user resets the exposed filter in the View, the filtering information is not displayed anymore, but the View remains filtered.

1
  • I removed that image you shared as it contained phone numbers etc. of what looks like real people; well done on your view by the way - it looks great; Nov 11, 2017 at 16:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.