Google maps not working in PF 3.9

edited October 2017 in phpFox

Apparently this is a known issue but I guess YouNet has no intention of fixing it in their legacy version of PF. I've tested this on the current version (4.5.3) and it's not a problem there.

What's going on is that in the Events module, PF should be pulling a map via a Google map api, into an event's page, but it doesn't.

I'm using the same Google API Key that works in the 4.5.3 version of PF, so I don't think that's the problem.

Using my browser inspector, I can see the browser receiving the following error:
Failed to load resource: the server responded with a status of 403 (Forbidden)

According to Google, the page where the map should appear should call the following from the page:
src="https : //maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap" (or http)

But, when viewing the page source, this appears no where on the page.

cespirtual has an excellent set of add-ons that work great in PF4, but so far I can't find anything for PF3.9. If I could, I would just buy and use that and remove the built in Google Map code.

Anyway, any help would be super appreciated.

Comments

  • edited October 2017

    default event module map references ( may need following through core.country etc and longitude latitude

    module/event/include/service/event.class.php
    lines
    104, 106, 113, 116, 120, 124,128, 131

    module/event/include/service/process.class.php
    lines
    86, 87, 88, 90, 207, 208, 209, 211

    module/event/include/component/block/map.class.php
    lines
    26, 31

    **i think its pulling the above from sql
    matter of yet finding where its being put there
    trying to get Wamp reinstalled to really have any worthwhile look into the database
    https://developers.google.com/maps/documentation/javascript/v2tov3 might be related? code examples lower in page

    Kirkus
  • Yeah compare their v4 with their v3 as they used the same thing in v4 with barely any changes. I would imagine you can just copy and paste the changes.

    Kirkus
  • You can use beyond compare, sublime text or diffmerge to compare the files easily. I prefer beyond compare.

    DuCarlion
  • beyond compare is a godsend
    pure artwork

  • I'd thought about comparing v3 and v4 files after I posted this. LOL. Great minds? I'm going to try the compare feature in my IDE first. If that doesn't work well, I'll try Beyond Compare. Thanks, guys!! I'm determined to fix this so, of course, I'll post what I discover here for others.

    data66
  • Some of the differences are pretty extensive. I don't think I'm good enough to modify the v3 files using the v4 files. I'm going to try a different track. It seems to me that the problem is that the page isn't sending google the api key. So I'm going to find out where the code to call the map is and hard code the api call.

    data66
  • edited October 2017

    It looks like hard coding the api key did the trick.

    In module/event/template/default/block/info.html.php at line 61 I added "&key=My-API-Key" immediately after "maptype=roadmap".

    So the end of line 61 looks like this:

    sensor=false&amp;maptype=roadmap&key=My-API-Key" alt="" /></a>
    

    ::

    I want to create a few more events and see how that goes, but I think we've got it.

    ::

    Thanks you guys!! I hope this helps someone else in the future.

    DuCarlion
  • edited October 2017

    @Kirkus I edited what I could of your post to add the code tags but it looks like the rest was stripped. can you please post according to the guidelines with the markdown so the code can be seen and thanks for the details :)

    Kirkus
  • Of course. So sorry.

    data66
  • edited December 2017

    Thanx to everybody for all these responses

Sign In or Register to comment.