Jump to:

3448 Posts in 1062 Topics by 738 members

Data Model Questions

SilverStripe Forums » Data Model Questions » Google Store Locator

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 863 Views
  • Mgc
    Community Member
    23 Posts

    Google Store Locator Link to this post

    Trying to make this tutorial work on SS http://code.google.com/apis/maps/articles/phpsqlsearch.html

    Here is my current code;

    <code>function markers() {
          // Get parameters from URL
          $center_lat = $_GET["Lat"];
          $center_lng = $_GET["Lng"];
          $radius = $_GET["radius"];
          $Markers = DB::query("SELECT Address, Name, Lat, Lng, ( 3959 * acos( cos( radians('%s') ) * cos( radians( Lat ) ) * cos( radians( Lng ) - radians('%s') ) + sin( radians('%s') ) * sin( radians( Lat ) ) ) ) AS distance FROM Marker HAVING distance < '%s' ORDER BY distance LIMIT 0 , 20",
          //$Markers = DataObject::get('Marker');
          return $this
          ->customise(array("Markers" => $Markers))

    as you can see i have a function that generates a xml file with all the markers that have been set on the backend admin.

    The file works great when i do a DataObject:get on the Marker class.

    However, this only brings up all markers.

    what i want is for the markers to come up based on the lng and lang using the formula above.

    The current code gives this error:

    [Notice] Undefined index: Lat

    any help or direction on this would be really appreciated ... regards,


Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.