How can I pass the filter parameters of one view to a different view on the same page? Summary

I have two seperate views on the same page - one Page and one Block that show two seperate content types respectively, but have a filter exposed for a field that they share. 

On the page of the first view, I have attached a block display of the second into a new region. I want the filter values of the exposed filter of the first view to also feed into the filter values of the second block view, if possible.

How it's currently set up

I have two views.

The first view, "Local branches", is a Page display that surfaces content of type Local branch. This content type has a Location field, powered by the Location module. On the view page, there is an exposed filter criteria:

Location: Distance / Proximity

which is exposed to the user as a text field and the origin in the filter settings set to Postal Code.

The code is then sorted by Distance / Proximity.

On the view page therefore, there is a text field where users can enter in a post code and it will return results closest to that Postal code.



The second view, "Shops", is a Block display that surfaces content of type "Shops". This content type is almost identical to the "Local branch" content type, in that it also has a Location field.

In this view, I have again an exposed filter:

Location: Distance / Proximity

that is set up the exact same way - but note that this is a Block display. It's again sorted by Distance / Proximity.



Finally, on the Page of the first view, "Local branches", I have placed the second view's Block, "Shops" in a seperate region. 

My hope is that the Shops block will somehow pick up the exposed filter settings from the URL built by the "Local branches" view, which looks like this:

http://www.example.com/local-support?distance[postal_code]=EN11+8RX&amp;distance[search_distance]=100&amp;distance[search_units]=mile

As you can see there are three parameters that power the exposed Postal code search form. Here's a crude diagram:



Problem

The Block view, "Shops", doesn't respond to the filter values in the URL, but just outputs all results sorted arbitrarily (there is no other sort atm). I would like it to respond with results as if it were using the exposed filter values from the "Local branches" view as its own exposed filter.

Potential solutions and queries

One thing I did try was to programatically create the "Shops" block, and render it on the view page /local-support and see if I could use the $_GET parameters and feed it directly in to the view. Code to generate the output looks something like this:

function _mymodule_shop_block_view() {
  $view = views_get_view('shops');
  $view-&gt;set_display("block_1");
  $view-&gt;set_arguments($args);
  $view-&gt;pre_execute();
  $view-&gt;execute();
  $content = $view-&gt;render();

  return $content;
}


The problem is I'm not sure what the value of $args would actually be in this case. I want to exectue and render the view, but pass the $_GET params in somehow, but they're exposed filter params so I don't know if $view-&gt;set_arguments is actually appropriate in this case?



My other thought that was because the "Shops" view is a Block display, the exposed filter won't work as it should. Could I try building it as a page display, expose it the Location filter as a block, and then rendering it in a block? I could hide the exposed filter in CSS (bad I know but if you haven't guessed by now I kinda wanna get this working).



Could attaching the block to the Page view integrate it - is it possible to do view attachements across separate views?



Thanks for taking the time to read this - I hope there's enough info about what I am trying to achieve!
Yes, it's possible to have 2 different views on the same page sharing the same exposed filter query parameters.

The trouble you're having is, by default, a block display doesn't show any exposed filters. The only way to enable this is by enabling the Use AJAX setting on the block view under the Advanced section in the admin UI. Once set, both the block &amp; page Views will pick up on the same location[postal_code]/location[distance]/location[search_units] query parameters. 

Of course this means, you'll have 2 different form filters on the same page but you can kludge your way around it with a style rule to hide it (e.g. #block-views-my_block_machine_name-block div.view-filters { display: none; }) or some other means of hiding the form.