Page 1 of 1

Google Map not working

Posted: Thu Aug 18, 2016 7:43 pm
by RachSobie
Hi ALl,

I'm using 2.2 with Pav_Flower exension.

I have found the file that the google map is located in as catalogue/view/theme/pav_flower/information/contact.tpl and I have added the lattitude and longitude of the store from google maps.

Code: Select all

</div>
 <?php // Jquery googlemap api v3?>
    <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&language=en"></script>
    <script type="text/javascript" src="catalog/view/javascript/gmap/gmap3.min.js"></script>
    <script type="text/javascript" src="catalog/view/javascript/gmap/gmap3.infobox.js"></script>
    <script type="text/javascript">
        var mapDiv, map, infobox;
        var lat = <?php echo isset($themeConfig['location_latitude'])?$themeConfig['location_latitude']:'52.454493'; ?>;
        var lon = <?php echo isset($themeConfig['location_longitude'])?$themeConfig['location_longitude']:'0.61711'; ?>;
        jQuery(document).ready(function($) {
            mapDiv = $("#contact-map");
            mapDiv.height(400).gmap3({
                map:{
                    options:{
                        center:[lat,lon],
                        zoom: 15
                    }
                },
                marker:{
                    values:[
                        {latLng:[lat, lon], data:"<?php echo isset($themeConfig['location_address'])?$themeConfig['location_address']:'P&R Garden Supplies,Fengate Drove, Weeting IP27 0PW, United Kingdom'; ?>"},
                    ],
                    options:{
                        draggable: false
                    },
                    events:{
                          mouseover: function(marker, event, context){
                            var map = $(this).gmap3("get"),
                                infowindow = $(this).gmap3({get:{name:"infowindow"}});
                            if (infowindow){
                                infowindow.open(map, marker);
                                infowindow.setContent(context.data);
                            } else {
                                $(this).gmap3({
                                infowindow:{
                                    anchor:marker, 
                                    options:{content: context.data}
                                }
                              });
                            }
                        },
                        mouseout: function(){
                            var infowindow = $(this).gmap3({get:{name:"infowindow"}});
                            if (infowindow){
                                infowindow.close();
                            }
                        }
                    }
                }
            });
        });
    </script>
    <?php //end contact map ?>
But the google map says "Oops something went wrong" and does not display.

Any help will be much appreciated.

Thank you in advance,
Rachel.

Re: Google Map not working

Posted: Fri Nov 11, 2016 10:54 am
by vlim
Hi Rachel,

I found this by iSense, which might work for you because you are using 2.2, doesn't work for me because I'm using 2.0.3.1

https://isenselabs.com/posts/how-to-add ... ntact-page

Cheers,
Vanessa