Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Data Model Questions /

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

Google Store Locator

Go to End



Community Member, 23 Posts

16 November 2010 at 6:10am

Trying to make this tutorial work on SS

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,