Distance location not filtering for cck location
When trying to create a view that will limit a list of locations based on the distance of the node that the views block is on from the other nodes, it will show all nodes regardless of the distance.
I don't know how to fix the problem, but did want to notify of the issues
Here is the error message that shows up
Notice: Undefined property: stdClass::$location in location_views_proximity_get_reference_location() (line 523 of /home/mytoejam/public_html/gonetrippin.com/sites/all/modules/location/location.views.inc).
Here is the view that I was using:
$view = new view;
$view->name = 'other_food_nearby';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Other Food Nearby';
$view->core = 7;
$view->api_version = '3.0-alpha1';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Other Food Nearby';
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['query']['options']['query_comment'] = FALSE;
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '5';
$handler->display->display_options['style_plugin'] = 'list';
$handler->display->display_options['row_plugin'] = 'fields';
/* No results behavior: Global: Text area */
$handler->display->display_options['empty']['area']['id'] = 'area';
$handler->display->display_options['empty']['area']['table'] = 'views';
$handler->display->display_options['empty']['area']['field'] = 'area';
$handler->display->display_options['empty']['area']['empty'] = FALSE;
$handler->display->display_options['empty']['area']['content'] = 'nothing here';
$handler->display->display_options['empty']['area']['format'] = 'filtered_html';
$handler->display->display_options['empty']['area']['tokenize'] = 0;
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = 0;
$handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim'] = 0;
$handler->display->display_options['fields']['title']['alter']['html'] = 0;
$handler->display->display_options['fields']['title']['hide_empty'] = 0;
$handler->display->display_options['fields']['title']['empty_zero'] = 0;
$handler->display->display_options['fields']['title']['link_to_node'] = 1;
/* Sort criterion: Content: Title */
$handler->display->display_options['sorts']['title']['id'] = 'title';
$handler->display->display_options['sorts']['title']['table'] = 'node';
$handler->display->display_options['sorts']['title']['field'] = 'title';
$handler->display->display_options['sorts']['title']['order'] = 'DESC';
/* Contextual filter: Content: Nid */
$handler->display->display_options['arguments']['nid']['id'] = 'nid';
$handler->display->display_options['arguments']['nid']['table'] = 'node';
$handler->display->display_options['arguments']['nid']['field'] = 'nid';
$handler->display->display_options['arguments']['nid']['default_action'] = 'default';
$handler->display->display_options['arguments']['nid']['default_argument_type'] = 'node';
$handler->display->display_options['arguments']['nid']['default_argument_skip_url'] = 0;
$handler->display->display_options['arguments']['nid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['nid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['nid']['summary_options']['items_per_page'] = '25';
$handler->display->display_options['arguments']['nid']['validate']['type'] = 'node';
$handler->display->display_options['arguments']['nid']['validate_options']['types'] = array(
'locationinfo' => 'locationinfo',
);
$handler->display->display_options['arguments']['nid']['validate_options']['access'] = 0;
$handler->display->display_options['arguments']['nid']['validate_options']['nid_type'] = 'nids';
$handler->display->display_options['arguments']['nid']['validate']['fail'] = 'empty';
$handler->display->display_options['arguments']['nid']['break_phrase'] = 0;
$handler->display->display_options['arguments']['nid']['not'] = 1;
/* Filter criterion: Location: Distance / Proximity */
$handler->display->display_options['filters']['distance']['id'] = 'distance';
$handler->display->display_options['filters']['distance']['table'] = 'location';
$handler->display->display_options['filters']['distance']['field'] = 'distance';
$handler->display->display_options['filters']['distance']['value'] = array(
'latitude' => '',
'longitude' => '',
'postal_code' => '',
'country' => '',
'php_code' => '',
'nid_arg' => 'nid',
'nid_loc_field' => 'field_location',
'uid_arg' => '',
'search_distance' => '15',
'search_units' => 'mile',
);
$handler->display->display_options['filters']['distance']['group'] = 0;
$handler->display->display_options['filters']['distance']['origin'] = 'nid_arg';
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
'locationinfo' => 'locationinfo',
);
$handler->display->display_options['filters']['type']['group'] = 0;
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 0;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Display: Block */
$handler = $view->new_display('block', 'Block', 'block');
Comment | File | Size | Author |
---|---|---|---|
#4 | location-1224038-distance-location-4-d7.patch | 806 bytes | MyXelf |
Comments
Comment #1
Ogredude CreditAttribution: Ogredude commentedSame issue here.
Comment #2
ankur CreditAttribution: ankur commentedI believe this issue has been addressed in a commit by bdragon here:
http://drupalcode.org/project/location.git/commit/e114659
Comment #3
smitty CreditAttribution: smitty commentedBut it seems, that this problem is not fixed.
Using only the "CCK location: field_adresse" all nodes are shown - regardless of the distance.
After disabling the "Node Location Modul" (previously used for this proximity search) there is the following error message on the node, where the block with the proximity ist integrated:
Comment #4
MyXelf CreditAttribution: MyXelf commentedThe referenced commit by bdragon didn't solve the problem entirely. There is still missing the language reference (LANGUAGE_NONE) while accessing the 'latitude' value. In location.views.inc, there is the following line:
if (isset($cck_location[LANGUAGE_NONE][0]['longitude']) && isset($cck_location[0]['latitude'])) {
should be:
if (isset($cck_location[LANGUAGE_NONE][0]['longitude']) && isset($cck_location[LANGUAGE_NONE][0]['latitude'])) {
The following patch will address this issue. After this, all should be working fine.
HTH
MyXelf
Comment #5
MyXelf CreditAttribution: MyXelf commentedChanging the status...
Comment #6
ankur CreditAttribution: ankur commentedApplied MyXelf's patch in #4 to 7.x-3.x
Thanks for catching that.