Location proximity filter

Events happening in the community are now at Drupal community events on www.drupal.org.
karens's picture

I've added a proximity filter to the location views module (http://drupal.org/project/location_views). It is still a bit of a proof of concept, but does seem to be working. It currently only computes distance in miles since I haven't yet figured out a way to shoehorn another selector into it to select other units. The module creates a Location: Proximity filter that you can add to views, along with a Location: Distance field that will display the distance between the selected postal code and the node's lat/lon. The functions and queries were taken from location.inc and earth.inc and re-factored to work in views.

Anyway, if anyone is using the location module and the zipcodes table (which is where I get the lat/lon to search on), and has nodes with lat/lon values that can be searched, I'd love to get some feedback.

Comments

Karen, this is incredible!

zacker's picture

I was hoping this would get built eventually. It's mind boggling how powerful views is becoming.

once again KarenS is driving change

dado's picture

Wow thanks Karen! Combined w/ views, location, events mods, you are dangerous! Will check this ASAP.

Don't forget her work on

merlinofchaos's picture

Don't forget her work on CCK, too.

Fantastic Stuff!

alanburke's picture

Great stuff Karen.

Some ideas.

For the default location, would it be possible to use the users own location.

This would be set by the user themselves in their account page.

[Its mainly self-interest, I admit. Postcodes aren't an option in my country, Ireland.
I use the Gmap module to allow users to set their location, and the same for nodes' locations .
This gives an exact GPS location, which I can their use Zacker's Gmap hack to display on a map]

Keep up the good work,
Alan
PS The elderweb demo is so good, I might even get interested in Fishing!

Thanks to all of you! It's

karens's picture

Thanks to all of you! It's nice to know the work is appreciated.

@alanburke, I agree there needs to be another way to select a search location besides postal code and I was trying to think how it could be set up. I hadn't thought about using the user location, but that makes sense, I'll take a stab at it when I get a chance.

I have a GMaps locator map

karens's picture

I have a GMaps locator map almost working as an alternative to the postal code selector. The idea is to use a GMaps map to click on the spot you want to use as your center point, then sort the view by proximity from that location. Everything works fine except that something is getting cached and it will only work the first time you use it. After that, it only works if I clear the cache. I have the filter set to cacheable='no', but that doesn't seem to be enough. I'm attaching the module on the location_views issue page in case anyone wants to try it out, but I don't want to commit it until I figure out where it's getting cached so I can stop the caching.

Anyone have any ideas on how to keep it from caching??

Figured out how to get it

karens's picture

Figured out how to get it working. See a demo at http://www.elderweb.com/demo/views/proximitymap.

Turns out it is that the form gets cached when the view is created. I fixed it by using views_pre_view to invalidate the cache so the form would re-generate. Now that I have it working I'm not sure it ought to work, but it does.

similar idea

Geocoding the filter

Anonymous's picture

Karen,

Thanks for a great addition. I have been testing this module for seveal months now and would like to make two suggestions.

Geocoding the filter
What about moving from zip code input to a broader zip code, city/state, address type of input linked into a geocoder (google,yahoo...). Geocoder returns a lat/lon and quality level. This would allows for a broader set of both US and international users. Geocoders have very good coverage for city/state/country and the zip code coverage is getting better. Street level is still bit limited, but also getting better. Since the geocoder returns a quality level the user can get an idea as to the level of accuracy (street level did not work but city/state/country did work). If a map is also integrated, the user could refine the location based on visual street/sat/hybrid input using the marker click/drag feature. Mixing text input (zip,street,city) via geocoding and map input (drag and zoom level determined by quality parameter) results in a more intuitive user interaction.

  • usage 1 - write address, get map, visual confirmation, refine or use view
  • usage 2 - write address, city level quality, refine using map, visual confirmation, refine or use view
  • usage 3 - write zip, country, best guess based via geocode, refine with map, visual confirmation, refine or use view
  • usage 4 - write city, state, country (single line) ... and so forth

Filter Form Layout
This may not be within the scope of this module, but I found the layout of the form was one of the biggest limitations. When I included node name, map and taxonomy1, taxonomy 2 (or proxmity zip) I found that my right margin became a bit crowded. What I was looking for was a way to stack name, taxonomy, zip on the left side with the map on the right side. Eventually I will figure out how to hack the themes and views guts to make it work.

Just some input... Thx

geocoding proximity filter in views

Boblouis's picture

Hi all,

The proximity filter is just a great idea.
But as mentioned in the above post, I think that it would be even better to use an address field instead of a zip field as an input, to calculate the distance between the entered address and a node.
Is there any plan do do so? Maybe there is something available already?

Proximity Filter in views

ej020586's picture

Karen,

I have location module installed for drupal 5.15 but I am unable to get a return value for a proximity filter in a view. I have zipcodes table filled with US values but still no results. Is there something I am missing?

Thnx

Don't think is there yet

marcobauli's picture

this feature would make my month, but i don't think it finished yet. There seems to be some work going on at http://drupal.org/node/343943 and http://drupal.org/node/321114 . Hope to be able to test later today. Big up for KarenS for all the work on this!

Documentation for views

glass.dimly's picture

Hello all, I've just updated the documentation for setting up a zip code proximity search using views and would appreciate feedback/revisions. I've got it working on my site.

http://drupal.org/node/359463

I am using proximity search

dpatte's picture

I am using proximity search to users, and it works great (very cool), but the fallback option (if the user enters no location) doesnt seem to work.
I'm now trying how to filter the nodes for a user session to a particular range. I have several views that use proximity, but I'd like to be able to set a field somewhere for the user and limit all views to that field range.

Hi, I was wondering if you

nyleve101's picture

Hi,

I was wondering if you used any patches to get your location proximity search working? Also, which version are you using?

Thanks in advance.

Here's my recipe...

criznach's picture

I have a site using Location 6.x-3.x-dev (2009-Jul-30), but I had to do write custom code to make it work how I wanted.

http://www.flyozoneusa.com/where-to-buy

I'm scared to update it because I don't want to break this. :) I found bits and pieces in various posts, but I can't find them now. I'm sure credit is due to someone for the exposed filter stuff... Be sure and import your zip database. If you don't funny things will happen and you may not see any errors.

Here is some code from my custom module that sets up the filter. Exported view below.

function custom_form_alter(&$form, $form_state, $form_id) {
// Only alter the exposed filter form on this views display
if ($form_id == 'views_exposed_form' && $form['#id'] == 'views-exposed-form-buy-fly-map-page-3') {

// Add some JS to AJAXify the view.
drupal_add_js($base_path . drupal_get_path('theme', 'flyozoneusa') . '/includes/flyozoneusa_custom.js');
drupal_add_js($base_path . drupal_get_path('theme', 'flyozoneusa') . '/includes/jquery.scrollTo-1.4.2-min.js');

// Prevents distance of zero or too large.  Trying to limit the results visible at one time.
$dist_opts = array('' => '<Select One>',
'50' => '50 Miles',
'100' => '100 Miles',
'250' => '250 Miles',
);

// Make the fieldset a bit nicer...
$form['distance']['#type'] = 'fieldset';
$form['distance']['#title'] = 'Enter your zip code to search for nearby retailers.';

$form['distance']['postal_code']['#title'] = 'Zip Code';
$form['distance']['postal_code']['#size'] = 10;

$form['distance']['search_distance']['#type'] = 'select';
$form['distance']['search_distance']['#options'] = $dist_opts;

$form['distance']['search_units']['#type'] = 'value';
$form['distance']['search_units']['#value'] = 'mile';

// Move submit into fieldset
$form['distance']['submit'] = $form['submit'];
unset($form['submit']);

unset($form['distance']['search_units']['#options']);
unset($form['distance']['search_units']['#default_value']);
}
}

function custom_views_pre_render(&$view) {
// Prevent the full list from being displayed if no zip is entered
if ($view->name == 'buy_fly_map' && $view->current_display == 'page_3') {
if (trim($view->exposed_data['distance']['postal_code']) == '') {
$view->result = array();
$handler = &$view->display_handler;
$options = &$handler->options;
$options['empty'] = '';
}
}
}

My view is as follows... Note that this has several displays, and depends on gmap and some CCK fields, so you probably can't just drop it into your site.

$view = new view;
$view->name = 'buy_fly_map';
$view->description = 'Buy and Fly Map';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
  'title' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'link_to_node' => 1,
    'exclude' => 0,
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'relationship' => 'none',
    'override' => array(
      'button' => 'Override',
    ),
  ),
  'tid' => array(
    'label' => 'Tags',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'type' => 'separator',
    'separator' => ', ',
    'empty' => '',
    'link_to_taxonomy' => 1,
    'limit' => 1,
    'vids' => array(
      '3' => 3,
      '2' => 0,
      '1' => 0,
    ),
    'exclude' => 0,
    'id' => 'tid',
    'table' => 'term_node',
    'field' => 'tid',
    'relationship' => 'none',
  ),
));
$handler->override_option('sorts', array(
  'province' => array(
    'order' => 'ASC',
    'id' => 'province',
    'table' => 'location',
    'field' => 'province',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
  'title' => array(
    'order' => 'ASC',
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('filters', array(
  'status' => array(
    'operator' => '=',
    'value' => '1',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'status',
    'table' => 'node',
    'field' => 'status',
    'relationship' => 'none',
  ),
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'retailer' => 'retailer',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => 'type_op',
      'label' => 'Node: Type',
      'use_operator' => 0,
      'identifier' => 'type',
      'optional' => 1,
      'single' => 1,
      'remember' => 0,
      'reduce' => 1,
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'relationship' => 'none',
    'override' => array(
      'button' => 'Override',
    ),
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('cache', array(
  'type' => 'none',
));
$handler->override_option('title', 'Search for Retailers');
$handler->override_option('use_ajax', TRUE);
$handler->override_option('items_per_page', 0);
$handler->override_option('style_plugin', 'gmap');
$handler->override_option('style_options', array(
  'grouping' => '',
  'macro' => '[gmap width=100% | height=400px]',
  'datasource' => 'location',
  'latfield' => 'title',
  'lonfield' => 'title',
  'markers' => 'nodetype',
  'markerfield' => 'title',
  'markertype' => 'kite red',
));
$handler = $view->new_display('page', 'Retailers Map', 'page_1');
$handler->override_option('fields', array(
  'title' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'link_to_node' => 1,
    'exclude' => 0,
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'relationship' => 'none',
    'override' => array(
      'button' => 'Override',
    ),
  ),
  'tid' => array(
    'label' => 'Tags',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'type' => 'separator',
    'separator' => ', ',
    'empty' => '',
    'link_to_taxonomy' => 1,
    'limit' => 1,
    'vids' => array(
      '3' => 3,
      '2' => 0,
      '1' => 0,
    ),
    'exclude' => 0,
    'id' => 'tid',
    'table' => 'term_node',
    'field' => 'tid',
    'override' => array(
      'button' => 'Use default',
    ),
    'relationship' => 'none',
  ),
  'address' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'hide' => array(
      'name' => 'name',
      'locpick' => 'locpick',
      'map_link' => 'map_link',
      'coords' => 'coords',
      'street' => 0,
      'additional' => 0,
      'city' => 0,
      'province' => 0,
      'postal_code' => 0,
      'country' => 0,
      'phone' => 0,
      'province_name' => 0,
      'country_name' => 0,
    ),
    'exclude' => 0,
    'id' => 'address',
    'table' => 'location',
    'field' => 'address',
    'relationship' => 'none',
    'override' => array(
      'button' => 'Override',
    ),
  ),
));
$handler->override_option('path', 'where-to-buy/retailers');
$handler->override_option('menu', array(
  'type' => 'tab',
  'title' => 'Retailers Map',
  'description' => '',
  'weight' => '0',
  'name' => 'primary-links',
));
$handler->override_option('tab_options', array(
  'type' => 'normal',
  'title' => 'Retailers & Demo Centers',
  'description' => '',
  'weight' => '0',
));
$handler = $view->new_display('page', 'Demo Centers Map', 'page_2');
$handler->override_option('fields', array(
  'title' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'link_to_node' => 1,
    'exclude' => 0,
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'relationship' => 'none',
    'override' => array(
      'button' => 'Override',
    ),
  ),
  'tid' => array(
    'label' => 'Tags',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'type' => 'separator',
    'separator' => ', ',
    'empty' => '',
    'link_to_taxonomy' => 1,
    'limit' => 1,
    'vids' => array(
      '3' => 3,
      '2' => 0,
      '1' => 0,
    ),
    'exclude' => 0,
    'id' => 'tid',
    'table' => 'term_node',
    'field' => 'tid',
    'override' => array(
      'button' => 'Use default',
    ),
    'relationship' => 'none',
  ),
  'address' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'hide' => array(
      'name' => 'name',
      'locpick' => 'locpick',
      'map_link' => 'map_link',
      'coords' => 'coords',
      'street' => 0,
      'additional' => 0,
      'city' => 0,
      'province' => 0,
      'postal_code' => 0,
      'country' => 0,
      'phone' => 0,
      'province_name' => 0,
      'country_name' => 0,
    ),
    'exclude' => 0,
    'id' => 'address',
    'table' => 'location',
    'field' => 'address',
    'relationship' => 'none',
    'override' => array(
      'button' => 'Override',
    ),
  ),
));
$handler->override_option('filters', array(
  'status' => array(
    'operator' => '=',
    'value' => '1',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'status',
    'table' => 'node',
    'field' => 'status',
    'relationship' => 'none',
  ),
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'retailer' => 'retailer',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => 'type_op',
      'label' => 'Node: Type',
      'use_operator' => 0,
      'identifier' => 'type',
      'optional' => 1,
      'single' => 1,
      'remember' => 0,
      'reduce' => 1,
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'relationship' => 'none',
    'override' => array(
      'button' => 'Override',
    ),
  ),
  'field_demo_flag_value' => array(
    'operator' => '=',
    'value' => array(
      'value' => '1',
      'min' => '',
      'max' => '',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'field_demo_flag_value',
    'table' => 'node_data_field_demo_flag',
    'field' => 'field_demo_flag_value',
    'override' => array(
      'button' => 'Use default',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('path', 'where-to-buy/demo-centers');
$handler->override_option('menu', array(
  'type' => 'tab',
  'title' => 'Demo Centers Map',
  'description' => '',
  'weight' => '10',
  'name' => 'navigation',
));
$handler->override_option('tab_options', array(
  'type' => 'none',
  'title' => '',
  'description' => '',
  'weight' => 0,
));
$handler = $view->new_display('page', 'By Zip', 'page_3');
$handler->override_option('fields', array(
  'title' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'link_to_node' => 1,
    'exclude' => 0,
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'relationship' => 'none',
    'override' => array(
      'button' => 'Use default',
    ),
  ),
  'tid' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'type' => 'separator',
    'separator' => ', ',
    'empty' => '',
    'link_to_taxonomy' => 1,
    'limit' => 1,
    'vids' => array(
      '3' => 3,
      '2' => 0,
      '1' => 0,
    ),
    'exclude' => 0,
    'id' => 'tid',
    'table' => 'term_node',
    'field' => 'tid',
    'override' => array(
      'button' => 'Use default',
    ),
    'relationship' => 'none',
  ),
  'city' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'exclude' => 0,
    'id' => 'city',
    'table' => 'location',
    'field' => 'city',
    'override' => array(
      'button' => 'Use default',
    ),
    'relationship' => 'none',
  ),
  'province' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'style' => 'name',
    'exclude' => 0,
    'id' => 'province',
    'table' => 'location',
    'field' => 'province',
    'override' => array(
      'button' => 'Use default',
    ),
    'relationship' => 'none',
  ),
  'distance' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'origin' => 'tied',
    'units' => 'mi',
    'latitude' => '',
    'longitude' => '',
    'exclude' => 0,
    'id' => 'distance',
    'table' => 'location',
    'field' => 'distance',
    'override' => array(
      'button' => 'Use default',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('filters', array(
  'status' => array(
    'operator' => '=',
    'value' => '1',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'status',
    'table' => 'node',
    'field' => 'status',
    'relationship' => 'none',
  ),
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'retailer' => 'retailer',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => 'type_op',
      'label' => 'Node: Type',
      'use_operator' => 0,
      'identifier' => 'type',
      'optional' => 1,
      'single' => 1,
      'remember' => 0,
      'reduce' => 1,
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'relationship' => 'none',
    'override' => array(
      'button' => 'Override',
    ),
  ),
  'distance' => array(
    'operator' => 'mbr',
    'value' => array(
      'latitude' => '',
      'longitude' => '',
      'postal_code' => '',
      'country' => 'us',
      'search_distance' => '',
      'search_units' => 'mile',
    ),
    'group' => '0',
    'exposed' => TRUE,
    'expose' => array(
      'use_operator' => 0,
      'operator' => 'distance_op',
      'identifier' => 'distance',
      'label' => '',
      'optional' => 1,
      'remember' => 0,
    ),
    'type' => 'postal_default',
    'identifier' => 'dist',
    'id' => 'distance',
    'table' => 'location',
    'field' => 'distance',
    'override' => array(
      'button' => 'Use default',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('style_plugin', 'default');
$handler->override_option('style_options', array(
  'grouping' => 'province',
));
$handler->override_option('row_options', array(
  'inline' => array(
    'city' => 'city',
    'province' => 'province',
    'distance' => 'distance',
  ),
  'separator' => ',',
));
$handler->override_option('path', 'where-to-buy/by-zip');
$handler->override_option('menu', array(
  'type' => 'default tab',
  'title' => 'By Zip Code',
  'description' => '',
  'weight' => '-20',
  'name' => 'navigation',
));
$handler->override_option('tab_options', array(
  'type' => 'normal',
  'title' => 'Where to Buy',
  'description' => 'Where to get the goods!',
  'weight' => '0',
));

Thank you sooooo much for

nyleve101's picture

Thank you sooooo much for your more than generous repsonse- I'm off to try your code now.

Your website is very very cool btw.

Great work!

ahimsauzi's picture

Subscribing

I have actually coded a

dpatte's picture

I have actually coded a solution around the fallback option and it now works for me.

Thanks for your response,

nyleve101's picture

Thanks for your response, much appreciated. Any chance I could get a peak at the code please?

fix for fallback option

Views Developers

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week