weekendize
Forum Replies Created
-
Unfortunately the page is not online yet, but we will put the website online soon.
Do you have any suggestions what I could try?
How can I alter the elements attributes from
data-map-settings?I put your code snippet in my js file after I created the instance of the map. But then I get the following error:
Uncaught TypeError: Cannot read property 'setCenter' of undefinedWhere do I have to put the code?
event.mapis not defined.Thanks.
Thanks, that worked perfectly.
One more question, how can I set the following map parameters in JavaScript?
map_start_lat, map_start_lng, map_start_location, map_start_zoomAt first, I register my JS-Script:
wp_register_script(‘wpgooglemaps_scripts’, get_stylesheet_directory_uri().’/js/wpgooglemaps.js’, array(‘wpgmza’),’1.0′, true);Next, I create the following div:
echo '<div id="wpgmza_map_100" data-maps-engine="google-maps" data-map-id="100" style="display: block; overflow: hidden; width: 100%; height: 400px; float: left; position: relative;"></div>';Than I enqueue my script that adds two markers to the map.
wp_enqueue_script(‘wpgooglemaps_scripts’);The issue is that the script is only working when I create a map with shortcodes before, e.g. with:
echo do_shortcode('[wpgmza id="1"]');Do you have any idea why I have to create a map with short code in order to load my JS script?
Whenever I remove the wpgmza dependency, the script is working.
Thanks in advance.
- This reply was modified 7 years, 9 months ago by weekendize.
When I create a map using shortcode in php, how can I get a reference to the map object in Javascript?
A further issue:
I added thedata-map-idattribute to the div element and tried it again. I was able to add a couple of markers to the new map with JavaScript.During testing I had also another map using the shortcode
echo do_shortcode('[wpgmza id="1"]');displayed on the page.As soon as I remove the map using the shortcode, my JavaScript file is not loading anymore at all.
Do you have any ideas/suggestions for this problem?
- This reply was modified 7 years, 9 months ago by weekendize.
Hey Perry,
I was able to enqueue the script with the dependency.
But I wasn’t able to create a map the way you suggested.var map = WPGMZA.Map.createInstance( document.getElementById("wpgmza_map_<id>") );I get the following error message:
Uncaught Error: Map ID must be an integer at WPGMZA.GoogleProMap.WPGMZA.Map [as constructor]Do you have any suggestions?
I get the error “Uncaught ReferenceError: WPGMZA is not defined” when I use the functions in my ‘functions.php’ or in a seperated js file. What file do I need to include in order to use the functions?
Thanks in advance.
Perfect, thanks!
And how can I add the markers to the created map?Thanks for your response.
How can I create an empty map with JavaScript? Do you provide any documentation/tutorial for your plugin regarding to JavaScript?Hi Perry,
sorry for the late reply, I was busy the last couple of weeks.
How can I set up a blank map on the page with JavaScript? With the function WPGMZA.Map.createInstance() or just use a shortcode? Is there a documentation where I can look up the necessary parameters?Thanks in advance.
SteffenHey Perry,
I have now the title, address, latitude and longitude etc. available in the module. What parameter do I have to pass to the function WPGMZA.Marker.createInstance? Or could you provide a short code snipplet?
Thanks in advance.
Steffen
Perfect, thanks. I will give it a try.
- This reply was modified 7 years, 11 months ago by weekendize.
Okay, we want to display products in the woocommerce shop page. Every product has an attribute „address“ which has the value of the products address (It‘s more a bookable activity than a product). We could also add a lat and lng attribute that stores the location of the product.
The maximum products that are displayed on one page are 4. We want to show a map with the markers of the actually displayed products. The user can filter the products in the front-end. Therefore we have to customize the markers on the map based on the actually displayed products.
The only solution that came in my mind was to create a map for every single product and use the Map Mashup to display a parent map in combination with the map of the actually displayed products.
Thanks for the quick response.
The users can filter entries based on specific attributes in the front-end. Depending on the filter I want to display all markers on a map that match the filtered attribute. Therefore I need to dynamically create maps with changing markers based on the filtered attributes.
Could I realize that with Map Mashup? If I have an empty parent map and add all matching entriees with the mashup_ids.
echo do_shortcode('[wpgmza id="2" mashup=true mashup_ids=<matching entries> parent_id="2"]);Is there any better solution for this problem?