Hi.

I have a full postal code set for South Africa and it is working. I used this patch: Location autocomplete implementation for cities that also makes use of my zipcodes table. This is very nice when creating locations, so your visitors cannot misspell the city names.

I created 3 towns on the coast in a straight line all +/- 20miles from each other, using Geocoded exact in the city centre. Lets call then city 1,2,3

Now if i Search for city 2, city1&3 shows, that's correct as the search is for 25miles. If I set my search to 5miles and search for city 2, city 1&3 still shows. So the distances drop-down makes no difference. If I search for city 1, City 2 shows, meaning it is correct in a 25mile radius, excluding city 3. But changing the distance to 1mile still shows both towns.

Now if I edit the view and edit distance filter, it states 25 miles and I change it to 5 miles and redo the search on city 1, only city 1 shows. If I increase the distances in the view to 100miles all 3 cities shows. This means the view work but the drop-down distance selector is not updating the view filter.

Also the Map Block is not updating the distance behaviour and only responds to the city search.
Same for the List Block

I can change the distance operator to Km in the view, but the header text still states miles.

Why is the map not an attachment to the listing page? In this way you can edit the marker handling.
Thanks

CommentFileSizeAuthor
#8 distance-screenshot.jpg78.23 KBvlooivlerke

Comments

NewZeal’s picture

I fixed the distance filter and it is in the current dev release and made the distance relate to the setting in the view. Obviously the user has to have the nous to realise that they have to reset the distance units in both the map and the listing.

NewZeal’s picture

BTW you should contribute your SA postal code set to the location module.

vlooivlerke’s picture

Hi I would love to contribute my SA postal codes but my client had to buy it from the Yanks (who cant play rugby but they have every post office marked in SA) and Pay in dollars. Then we had to chop and change it too. I will ask him how he feels about contributing to drupal.

Testing new Dev
Thanks.

NewZeal’s picture

Yeah I agree, the yanks can't play rugby. BTW go Springboks in the world cup! (just thought I'd get that in to hedge my bets).

vlooivlerke’s picture

Distance now working on dev

Thanks

vlooivlerke’s picture

Ok, spoke too soon.

What works is the listing page with the distance filter now connected.

But it does not connect the distance filter with the following blocks
ListingsList: Block
ListingsMap: Block

If I edit the view and change the distance the block responds (map and listing block) so it is the same issue where the distance filter is not connecting with the view filter.

And on another note, the ListingsMapbyCity: Block does not connect to the location=city view, but works if I set the filter inside the view.

thanks.

NewZeal’s picture

OK, the distance setting in the View does not work. It is overridden by the value on the search form which is stored in a session variable so that it always has the most recent setting. I need to add information to that view informing the admin that the distance setting is disabled.

vlooivlerke’s picture

StatusFileSize
new78.23 KB

Here is a view where I have added an map attachment.
The content type I created is called "listing"

$view = new view;
$view->name = 'ListingsList';
$view->description = 'Listings to go with ListingsMap';
$view->tag = 'listing';
$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(
  'nid' => array(
    'label' => 'Nid',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_node' => 0,
    'exclude' => 1,
    'id' => 'nid',
    'table' => 'node',
    'field' => 'nid',
    'relationship' => 'none',
  ),
  'title' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_node' => 1,
    'exclude' => 0,
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'relationship' => 'none',
  ),
  'tid' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      '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' => 0,
    'limit' => 0,
    'vids' => array(
      '2' => 0,
      '5' => 0,
      '1' => 0,
      '4' => 0,
      '3' => 0,
    ),
    'exclude' => 0,
    'hide_empty' => 0,
    'empty_zero' => 0,
    'id' => 'tid',
    'table' => 'term_node',
    'field' => 'tid',
    'relationship' => 'none',
  ),
  'address' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'hide' => array(
      'name' => 'name',
      'country_name' => 'country_name',
      'map_link' => 'map_link',
      'coords' => 'coords',
      'street' => 0,
      'additional' => 0,
      'city' => 0,
      'province' => 0,
      'postal_code' => 0,
      'country' => 0,
      'locpick' => 0,
      'fax' => 0,
      'phone' => 0,
      'province_name' => 0,
    ),
    'exclude' => 0,
    'id' => 'address',
    'table' => 'location',
    'field' => 'address',
    'relationship' => 'none',
    'override' => array(
      'button' => 'Override',
    ),
  ),
));
$handler->override_option('filters', array(
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'listing' => 'listing',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'relationship' => 'none',
  ),
  'status' => array(
    'operator' => '=',
    'value' => '1',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'status',
    'table' => 'node',
    'field' => 'status',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
  'targeted_proximity' => array(
    'operator' => 'in',
    'value' => array(
      'latitude' => '',
      'longitude' => '',
      'postal_code' => '',
      'country' => '',
      'search_distance' => '25',
      'search_distance_inner' => '',
      'search_units' => 'mile',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'type' => 'latlon',
    'identifier' => 'dist',
    'id' => 'targeted_proximity',
    'table' => 'location',
    'field' => 'targeted_proximity',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
  'tid' => array(
    'operator' => 'or',
    'value' => '',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'type' => 'textfield',
    'limit' => TRUE,
    'vid' => '1',
    'id' => 'tid',
    'table' => 'term_node',
    'field' => 'tid',
    'hierarchy' => 0,
    'relationship' => 'none',
    'reduce_duplicates' => 0,
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('cache', array(
  'type' => 'none',
));
$handler->override_option('title', 'Directory Listing');
$handler->override_option('header_format', '2');
$handler->override_option('header_empty', 1);
$handler->override_option('footer', '<?php
global $pager_page_array, $pager_total_items, $pager_total;
echo "<br />";
$my_view = views_get_current_view();
$items_per_page = $my_view->pager[\'items_per_page\'];
if ($pager_total[0] == 1) {
  echo "Showing <b>" . $pager_total_items[0] . "</b> results";
} else {
  $start = 1 + ($pager_page_array[0] * $items_per_page);
  $end = (1 + $pager_page_array[0]) * $items_per_page;
  if ($end > $pager_total_items[0]) $end = $pager_total_items[0];
  echo "Showing $start-$end of <b><span class=\'count\'>" . $pager_total_items[0] . "</span></b> results";
}
?>');
$handler->override_option('footer_format', '3');
$handler->override_option('footer_empty', 0);
$handler->override_option('empty', 'No listings available.  Please broaden your selection.');
$handler->override_option('empty_format', '2');
$handler->override_option('items_per_page', 20);
$handler->override_option('use_pager', '1');
$handler->override_option('distinct', 1);
$handler->override_option('style_options', array(
  'grouping' => '',
));
$handler->override_option('row_options', array(
  'inline' => array(
    'address' => 'address',
    'city' => 'city',
  ),
  'separator' => '',
));
$handler = $view->new_display('block', 'Block', 'block_1');
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
$handler = $view->new_display('attachment', 'Attachment', 'attachment_1');
$handler->override_option('style_plugin', 'gmap');
$handler->override_option('style_options', array(
  'grouping' => '',
  'macro' => '[gmap ]',
  'datasource' => 'location',
  'latfield' => 'nid',
  'lonfield' => 'nid',
  'markers' => 'static',
  'markerfield' => 'nid',
  'markertype' => 'alt small red',
  'center_on_nodearg' => 0,
  'center_on_nodearg_arg' => '',
  'highlight_nodearg' => 0,
  'highlight_nodearg_arg' => '',
  'highlight_nodearg_color' => '#FF0000',
  'tooltipenabled' => 0,
  'tooltipfield' => 'nid',
));
$handler->override_option('attachment_position', 'after');
$handler->override_option('inherit_arguments', TRUE);
$handler->override_option('inherit_exposed_filters', 1);
$handler->override_option('inherit_pager', FALSE);
$handler->override_option('render_pager', TRUE);
$handler->override_option('displays', array(
  'default' => 'default',
  'block_1' => 0,
));

Here is a screen-shot of the view.

There is someting interesting happening here. I have created a listing called "Pizza Palace" I have listed it in both town 1 and 2 Buy allowing my content type to add more than one location [lid]. When a search 1 mile in town 1 Pizza Palace show on town1 address and marker. If I search more than 25miles it does not show pizza palace in town 2.

If i search town 2, Pizza Palace shows a marker and address in town 2 but no marker in town 1

NewZeal’s picture

The complication might be caused by adding more than one location in a content type. The module assumes only one location per node and not two or more. Views might natively be able to handle that, but this programmatic implementation of Views may not be able to yet.

vlooivlerke’s picture

Multi location display is fixed when you make the map display (NOT Distinct) but keep the default display (Distinct).

So using a map attachment set to (NOT Distinct) works perfect with distance search with multiple locations per listing.

NewZeal’s picture

So are you getting good results with the view now? I'm not sure what you mean here.

vlooivlerke’s picture

Yes, this view works great. It is a simple page (default view) and a map (attached view).

The block part (block map view) does not carry over the distance filter, but the distance filter does have an affect on the attached view.

NewZeal’s picture

OK, cool.

NewZeal’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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