The module page says that Exposes Smart IP visitor's location details to Views field is D6-only. It'd be nice on D7 too. I can start testing as soon as it's ported.

Comments

arpeggio’s picture

I'll try to work on this feature for D7 on my free time. Of course, patches are always welcome. Thank you.

dbourrion’s picture

Would be a really nice feature...

alex.neblett’s picture

Priority: Normal » Major
Status: Active » Needs work
StatusFileSize
new5.49 KB

Hi,

Consider this a starting point. I had a couple of hours to migrate this up to D7 and take care of the obvious.

Right now, most of the module works, but views is not getting the data...

I am hoping to have some more time tomorrow to work on it and do some debugging. Of course, peer review and improvements to this starting point are welcome and appreciated.

I have a secondary motivation for making this work. I wanted to have a node with Get Directions that could navigate to the customer location from the service techs device (android tablet, ipad, etc. using smart ip) . Since I could not get both to co-exist on the same node so that I could have a fresh device geolocation (Get Directions causes navigator.geolocation.getCurrentPosition to fail with error.code = 2.), my next best option is to pass the latlon via a link in views along with the order_id to the Get Directions node.

Cheers,

Alex

alex.neblett’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new5.5 KB

All done!

Please review and commit. The issue was that Views 3 truncates names to 60 characters unlike Views 2.

Cheers,

Alex

Xomby’s picture

Fatal Error: Class "openlayers_proximity_handler_filter_circle" not found in "smart_ip_views_bridge_openlayers_proximity_handler_filter_circle.inc" on Line 3.

Looks like this bridge module relies on OpenLayers Proximity, which does not have an official D7 release. I need to use this data for a proximity lookup, so...

I'm going to see about bridging this to the location module, as I think that could work out quite nicely. Will post back here if I come up with anything.

[update] I was going to roll a module that patched in the required code, but darned if I can't figure out how to hook an actual module function... but here's the skinny of getting this to work with location (I'm not actually sure if the previous bridge module is necessary or not at this point, but I kinda think not):
Assuming you're working with:

  1. location 7.x-3.x-dev
  2. smart_ip 7.x-1.x-dev

then you can USE SMART_IP WITH THE LOCATION MODULE.

There's four(4) files you need to modify in the location module.
location.views.inc
In the location_views_proximity_get_reference_location function (line 456), inside the case statement, include the following case:

   case 'smart_ip':
      if(isset($_SESSION['smart_ip']['location']['latitude']) && isset($_SESSION['smart_ip']['location']['longitude'])){
          $coordinates['latitude'] = (float) $_SESSION['smart_ip']['location']['latitude'];
          $coordinates['longitude'] = (float) $_SESSION['smart_ip']['location']['longitude'];
	}
      break;

location_handler_field_location_distance.inc
in the extra_options_form function (line 29), in the #options array, after 'distance_arg' I added the following element:
'smart_ip' => t("User's Latitude / Longitude from Smart IP (blank if unset)"),

location_views_handler_filter_proximity.inc
in the value_form function (line 75), again in the #options array, same deal
'smart_ip' => t("User's Latitude / Longitude from Smart IP (blank if unset)"),

and finally:
location_handler_sort_location_distance.inc
in another extra_options_form function (line 28), inside the #options array, add
'smart_ip' => t("User's Latitude / Longitude from Smart IP (blank if unset)"),

note- your mileage may vary, as this is a rough hack that got me where I needed to be today. I welcome anyone to spruce this up or explain any hooks that could have been used to inject this functionality - or roll this into a real module - but it works for me. Also note - I'm still not sure if the previous bridge module is required for this or not, but I suspect it is not, as the smart_ip module sets the $_SESSION variables, and that's all this relies on.

[EDIT] This is a horribly WRONG way to implement it, and it doesn't "show" up the way it probably should because I just hacked it together without really understanding what or why... but it does work. please please please someone clean this up![/EDIT]

afidegnum’s picture

Issue summary: View changes

Hi, any update about this?

I need it badly :)

chris.jichen’s picture

StatusFileSize
new21.35 KB

On #4's code, there are incorrect smart ip API calls in the views field handler. It gave me blank value. Hence i use the standard Smart IP api function:
$smart_ip_session = smart_ip_session_get('smart_ip');
Instead of:
$_SESSION['location'];

The updated code has been attached.

Hope this will help someone.

Thanks

colan’s picture

Status: Reviewed & tested by the community » Needs work

Patches must be provided in patch format.

spyderpie’s picture

Any update on this? I so need this to work.

Peace,
Julie

  • arpeggio committed 90d93b0 on 7.x-2.x
    Issue #1378320 by arpeggio: Views support for D7
    
arpeggio’s picture

Status: Needs work » Fixed

I have already completed this feature request.

Status: Fixed » Closed (fixed)

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