Is there a way to have more than one exposed filters block for a view? Which different filters set for each block?

Would cloning a page view and altering the cloned view's exposed block have any detrimental effect on the initial view? I don't want the cloned view to have a different page url though..

Comments

merlinofchaos’s picture

Not with the same URL, unfortunately. You might be able to do some stuff with blocks with exposed filters, and exposing the filters in a block (that's weird) and have them all go to the same URL, but it only really works if the base 'page' filter has *all* of the filters as possible and any that might not be present are set to be optional. That *could* work. Maybe.

azoho’s picture

Thanks merlin,

what I want to do is have a block with filters for title, author, fulltext search, category. And another block just for fulltext search. So my base page has all the filters enabled.

Plan is to show the 1st block on my frontpage, and the 2nd block in the header of all pages. It all leads to a catalogue page.

How would I get more than one exposed filters block?

azoho’s picture

I just realised I have been saying 'expose filter blocks' when they are actually referred to as 'exposed form as block', so what I want is to several of these form blocks, each with separate set of filters, all leading to a single catalogue search page.

azoho’s picture

Title: Multiple exposed filters blocks » Multiple exposed form blocks
dawehner’s picture

This might be possible with a custom exposed form plugin.

danny_joris’s picture

Version: 6.x-2.6 » 6.x-2.11

I believe I had a similar issue and this is how I solved it.

What I have:
I have one views page with a path named, say content_list. This page includes an exposed filter of 3 taxonomy term drop down lists.

What I need:
I want to add another block with exposed filters which I can put on every page of the site. Using this exposed filter form will redirect to the content_list page and filter the content there.

How I solve it:
I add another page display on the same view which looks exactly the same as the original page. The only differences are: I name the path content_list2 and the exposed filters are displayed in a block. I show this block on every page except on content_list.

In a custom module I add this:

/**
* Implementation of hook_form_alter()
*/
function custom_form_alter(&$form, $form_state, $form_id) {
	
  if ($form['#id'] == 'views-exposed-form-your_views_page_id') {
     //override /content_list2 with /content_list	
     $form['#action'] = '/content_list';
  }
}

Note: I believe this would only work if the original content_list page has the same filters enabled as the exposed block...

It's a tweak, but I hope it is helpful for others as well.

dawehner’s picture

Status: Active » Fixed

Cool. I think people could use your code

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

giorgosk’s picture

don't need a custom module to override action path
can also use something like this in your template.php

function THEMENAME_preprocess_views_exposed_form(&$vars) {
  if ($vars['form']['#id'] == 'views-exposed-form-VIEW-NAME-ID') {
     //alter the $form array here
     $vars['form']['#action'] = 'path_to_view';
  }
}

instead of THEMENAME can also use "phptemplate"
EDIT:warning: this is untested code

above code does not do the job
need to re-render the form and I don't know how to do it

playfulwolf’s picture

Version: 6.x-2.11 » 7.x-3.x-dev

Any ideas how to do this on Drupal 7?

user654’s picture

.

mimrock’s picture

Status: Closed (fixed) » Active

The issue is not solved in Drupal 7.

berliner’s picture

From some ideas I found on the web while trying to solve this problem, I wrote a module that provides one additional block. Give it a try, maybe it works for you: https://drupal.org/sandbox/berliner/2087181. I explained the rationale behind it here: http://blog.dev030.com/posts/additional-exposed-filter-block-views

mlanning’s picture

#13 is working great for me so far. Exactly what I was looking for. Thank you berliner!

mustanggb’s picture

Issue summary: View changes
Status: Active » Closed (outdated)