Views exposed filters hierarchical display
Hello, I am building a website with lots of media products on it, which should be sort- and filterable. I have set up one content type with CCK for each media type. These content types all have different taxonomy vocabs assigned to them, as well as special CCK fields. (Example see below.) I have created a bunch of nodes using my CCK custom content types. Now I want to create an area, where the user can filter and narrow down his/her selection of media. I have built this filter area with 'Views' module, using exposed filters. --- I have the following problem: Is it possible with views.module that you start with one drop down selection menu (in my example taxonomy vocab 'Media type'), and depending on what the user selects there, he/she is presented with the next selection of dropdown menus? **Set-up:** A) - Taxonomy vocab 'Media type' --- Taxonomy term 'Book', automatically assigned to content type 'Book' --- Taxonomy term 'Magazine', automatically assigned to content type 'Magazine' --- Taxonomy term 'Video', automatically assigned to content type 'Video' B) - Content type 'Book' --- Taxonomy vocabulary 'Book type', assigned to content type 'Book' ----- Taxonomy term 'Hardback' ----- Taxonomy term 'Paperback' - Content type 'Magazine' --- CCK field: ISSN number - Content type 'Video' --- Taxonomy vocabulary 'Film format', assigned to content type 'Video' ----- Taxonomy term 'VHS' ----- Taxonomy term 'DVD' ----- Taxonomy term 'Download' **Scenario:** User goes to filter area. First of all he/she sees a drop-down menu with the vocab for 'Media type'. After having selected media type 'Book', he/she is presented with a second dropdown menu, containing the taxonomy terms for taxonomy vocabulary 'Book type'. Do I make any sense? Help very much appreciated, Laura.
On Aug 15, 2007, at 6:37 AM, laura oldenbourg wrote:
Do I make any sense?
Yes, and I hope someone has a good answer for you. ;) We're going to want exactly the same thing for the issue queues once they're ported to using views (which will be happening in the relatively near future). Here's our use case: you start at project/issues and there's a dropdown for the project you care about. Once you select that, it should filter based on that project, and then let you filter based on the components and versions available for that particular project... For this to be real painless, there's needs to be some jQuery + Ajax for this. The alternative is that the first level filter ends up redirecting you to a different page with the filter term as a URL argument (in your case, media type, in mine, the project name), and then the view on those pages can automatically provide the right additional filters based on the URL arg. Or something. ;) I haven't actually tried to solve this problem yet, so I don't have any real advice. But I wanted to mention that drupal.org and project* will need this in the not-too-distant future, so anyone who wants to help Laura will also be helping everyone. Cheers, -Derek (dww)
Hi Laura, this is certainly possible. I've done it right here: http:// 64.40.146.141/forum/filter. Please choose "Chipset" first, then select "fixed" in the status for a demo. Then choose "Graphics A" or so. Only the first set of conditional selects have been configured properly for everything. Basically this is "my own project management system" (remotely, actually). It's based on taxonomy. And the reason I built it, was that I needed something *much* more simple in use for my users than the project* modules. Note that it could still use some theming. It's called condvoc, which stands for Conditional Vocabularies. How does it work? You create vocabularies as you like. Then you can configure in the condvoc administration page (which probably has the worst usability ever, because of the amount of configuration required) which vocabulary/vocabularies should be displayed when which term is selected (also possible: display when any child term of the selected term is selected). So what you basically do, is configuring the relationships between terms and vocabularies, i.e. which vocabulary depends on which term(s). It's also possible to configure it through PHP, which is IMO a whole lot simpler, it uses a fairly simple hierarchical array structure in which you put the tid's and vid's. However, this was the first module I ever wrote. The admin page alone is 400 lines, the .module is 500 lines and the .module generates a lot of JavaScript, for the conditionals to work. That's right, instead of providing the JS with some settings (via Drupal.settings), I'm generating the code specific for that page. No AJAX requests are made, all vocabulary selects are rendered and are sent in the HTML. Whomever read this far, congratulations :P I hope this information is at least somewhat useful to you. It should learn you that this is a possible approach, but it's a very flawed one. Things you should not take over: 1) no JS should be generated 2) somehow, the administration should be kept manageable I think to do this properly, a Relationship API would be very, very useful. Unfortunately, the few modules that attempted to do this have been discontinued IIRC. And an AHAH/AJAX interface for defining the relationships (drag 'n drop, like Panels 2) would be *very* useful to keep the administration usable. It would be possible to create a module that allows for conditional exposed filters, but a more generic solution ("Conditial Form Items" or something like that?) would be better. I'm interested in helping with this, but not in writing it on my own. Looking forward to the feedback :) Wim Leers mail work@wimleers.com mob. 0032 (0)495 83.63.68 On Aug 15, 2007, at 15:37 , laura oldenbourg wrote:
Is it possible with views.module that you start with one drop down selection menu (in my example taxonomy vocab 'Media type'), and depending on what the user selects there, he/she is presented with the next selection of dropdown menus?
Hi Derek, Wim, everyone, thanks very much for your replies. @ Derek: yes it's true, I could build a workaround, with the level one terms linking to different sites, but that would be unnecessarily time-consuming... but I will try it anyhow, for I don't have a proper solution so far. @ Wim, the convoc module you have on your site is exactly what I need. Unfortunately I am not able to write a module like that myself. Is anyone by any chance interested in doing so, or is there already a module out there that can handle conditional vocabs? I think a module like this would be *very* useful for the Drupal community, and would be appreciated by a lot of people, don't you? Thank you, Laura
Category module does something like this with the activeselect module, though it doesn't do it on views. http://category.greenash.net.au/node/119 But I guess it wouldn't be too hard to give it some nice view integration. On 17/08/07, laura oldenbourg <laura.oldenbourg@googlemail.com> wrote:
Hi Derek, Wim, everyone, thanks very much for your replies.
@ Derek: yes it's true, I could build a workaround, with the level one terms linking to different sites, but that would be unnecessarily time-consuming... but I will try it anyhow, for I don't have a proper solution so far.
@ Wim, the convoc module you have on your site is exactly what I need. Unfortunately I am not able to write a module like that myself. Is anyone by any chance interested in doing so, or is there already a module out there that can handle conditional vocabs?
I think a module like this would be *very* useful for the Drupal community, and would be appreciated by a lot of people, don't you?
Thank you, Laura
-- Regards Steven Jones
Wow, this whole thread just proved ridiculously useful for a project we're trying to land. Thanks! Steven Jones wrote:
Category module does something like this with the activeselect module, though it doesn't do it on views.
http://category.greenash.net.au/node/119
But I guess it wouldn't be too hard to give it some nice view integration.
On 17/08/07, *laura oldenbourg* <laura.oldenbourg@googlemail.com <mailto:laura.oldenbourg@googlemail.com>> wrote:
Hi Derek, Wim, everyone, thanks very much for your replies.
@ Derek: yes it's true, I could build a workaround, with the level one terms linking to different sites, but that would be unnecessarily time-consuming... but I will try it anyhow, for I don't have a proper solution so far.
@ Wim, the convoc module you have on your site is exactly what I need. Unfortunately I am not able to write a module like that myself. Is anyone by any chance interested in doing so, or is there already a module out there that can handle conditional vocabs?
I think a module like this would be *very* useful for the Drupal community, and would be appreciated by a lot of people, don't you?
Thank you, Laura
-- Regards Steven Jones
-- Sean Robertson Web Developer NGP Software, Inc. seanr@ngpsoftware.com (202) 686-9330 http://www.ngpsoftware.com
participants (5)
-
Derek Wright -
laura oldenbourg -
Sean Robertson -
Steven Jones -
Wim Leers