• Hello, I’ve tried to insert a Universal snippet in the product page of a woocommerce site in test.

    I use Geo Mashup plugin for the coordinates of the product and I’ve a php script that already works for the openweathermap API with a Woody PHP snippet and I insert it in the google code that you can see here to get lat and lon

    https://developers.google.com/maps/documentation/javascript/examples/streetview-embed#all

    with this code in the Universal snippet insert in the product pages I don’t see nothing (no error and no Street view containers)

    <html><head><script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script>
        <script
          src="https://maps.googleapis.com/maps/api/js?key=MY_API_KEY&callback=initialize&libraries=&v=weekly"
          defer
        ></script>
        <style type="text/css">
          html,
          body {
            height: 100%;
            margin: 0;
            padding: 0;
          }
    
          #map,
          #pano {
            float: left;
            height: 100%;
            width: 50%;
          }
        </style>
        <script>
          "use strict";
    
     <?php
    $lat =1;
    $lon =2;
    if (function_exists('geo_mashup_map')) {
    $coords = GeoMashup::post_coordinates(); 
    if ($coords) { $lat = $coords['lat']; $lon = $coords['lng'] ; }
    }
    $js ="function initialize() {
      const fenway = { lat: $lat, lng: $lon };
      const map = new google.maps.Map(document.getElementById(\"map\"), {
        center: fenway,
        zoom: 14
      });
      const panorama = new google.maps.StreetViewPanorama(
        document.getElementById(\"pano\"),
        {
          position: fenway,
          pov: {
            heading: 34,
            pitch: 10
          }
        }
      );
      map.setStreetView(panorama);
    }";
    echo do_shortcode($js); 
    ?>
    
           
        </script>
    	</head>
      <body>
        <div id="map"></div>
        <div id="pano"></div>
      </body>
    </html>

    Can you help me?
    Thank you,
    Riccardo

Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Google Street view containers in universal snippet’ is closed to new replies.