dynamic / silverstripe-locator

SilverStripe Locator Module. Show locations on a map. Search by geoposition.
http://www.dynamicagency.com/labs/silverstripe-locator-module/
BSD 3-Clause "New" or "Revised" License
21 stars 7 forks source link

Google map not rendering, Silverstripe 4.6.1 #225

Closed TimStannard closed 3 years ago

TimStannard commented 3 years ago

Hey guys, the google map doesn't render in the CMS and the front end (Silverstripe 4.6.1) I'm running on a localhost (MAMP), Google chrome. My Google API keys are added to the yml file (tested and valid). They aren't restricted. I have installed all the requirements:

        "dynamic/silverstripe-locator": "3.1.1",
        "muskie9/data-to-arraylist": "^2.0",
        "symbiote/silverstripe-gridfieldextensions": "^3",
        "dynamic/silverstripe-geocoder": "^1.2"

and I've added a few addresses. Any ideas here? Thanks heaps

TimStannard commented 3 years ago

If his helps, I've worked out it's not returning a request: The following line of code is running in the LocatorController.php (line 87)

       // prevent init of map if no query
        $request = Controller::curr()->getRequest();
        if (!$this->getTrigger($request)) {
            return;
        }
muskie9 commented 3 years ago

Hi @TimStannard,

The getTrigger() method checks if a search has been run by looking for the get var action_doFilterLocations. This get var is set as a config value on LocatorController.

I believe the way it is implemented in in the 3.1 release line, if the get var is not detected in the url, it will not return results. I'd have to check the reasoning here with the team for the current implementation. I believe in most of our use cases we do not display results until the user does a search, which then adds the get var to the url as a part of the form submission.

One suggestion I have, if this is a new project you're working on, would be to use master as it has been refactored quite a bit and while not tagged, is close to release. There is currently a PR #220 that will allow showing results on page load per location page. I believe once that is merged it would allow the behavior you're looking for.

TimStannard commented 3 years ago

Hey, that's lit. The master branch is now rendering the map. Thanks for the heads up :)

muskie9 commented 3 years ago

Glad that did it @TimStannard. We're hoping to tag/release the new major version soon, but in the mean time let us know if there is anything else you notice that seems to be broken. I'll close this ticket for now based on it working and the above comment noting the PR.