B
B
burguy832019-06-05 17:34:58
Google Maps
burguy83, 2019-06-05 17:34:58

How to integrate reviews into a website using google maps api?

Hello connoisseurs and connoisseurs. I’m not quite catching up (even after reading the api manuals) on how to integrate reviews to my site. At the moment, I was able to set a marker at the address of the company, and now I would also like to pull out reviews from google maps, and as I understand it, in order to have a more accurate result, you need to specify not only the latitude and longitude, but also the name of the company. How can this be implemented? Does anyone have a working version?
P.S. I found an example where when manually specifying latitude and longitude, reviews are displayed. Checked .. it works. But I have 100 thousand such companies and I didn’t quite figure out how to make it so that data from geocoding is substituted there.
Now I use geocoding to put marks on the map.
My script:

<div id="map" style="width: 100%; height: 500px; position:center; border: solid 1px #f2a938"></div>
    <script type="text/javascript">
        var map;
        var geo;
        function init() {
            geo = new google.maps.Geocoder();
            var opt = {
                zoom:15
            }
            map = new google.maps.Map(document.getElementById('map'), opt);
            var address = "<?php echo $content['company']['domicilios']['calle'];?>,+<?php echo $content['company']['domicilios']['numero'];?>+<?php echo $content['company']['domicilios']['localidad'];?>+<?php echo $content['company']['domicilios']['provincia'];?>+<?php echo $content['company']['domicilios']['codigo_postal'].", Argentina";?>"
            //console.log(address)
            geo.geocode({'address' : address}, function (results,status)           {
                if (status == google.maps.GeocoderStatus.OK){
                map.setCenter(results[0].geometry.location);
                var marker = new google.maps.Marker({
                    map:map,
                    position:results[0].geometry.location
                });
                 }
                
            });

        }


    </script>


    <script src="https://maps.googleapis.com/maps/api/js?key=XXX"></script>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question