Okay
  Public Ticket #1859677
Queries on Reminders, Map Clustering, etc
Closed

Comments

  • dovetaildesign started the conversation

    hi there

    Just a few queries if you can help:

    1) I really need to be able to display all upcoming events on the map - not just those of the current month. Is this possible?

    2) I also need to implement the clustering feature of the google maps. Google provide a js file for this, can I add this onto the functionality of the map? 

    3) is there a way I can automatically make the user get reminders if they get a ticket rather than having to separately press the reminders button? Even if the buy button triggers the reminders button action before the add to cart?


    Thanks for your help guys 



  •  878
    Zhivko replied

    Hi,

    1) Open file \stachethemes_event_calendar\front\js\stec.js on line 4040 edit:

                            var to = sd.endOf('month').toDate();

    to

                            var to = sd.endOf('year').toDate();

    This will increase the range to the end of the year instead of end of the month.

    2) To add clustering on line 4086 after the $.each loop add:

    var markerCluster = new MarkerClusterer(parent.gmap, parent.markers, {imagePath: 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m'});

    You will have to load the js library as well:

    Open file stachethemes/shortcodes/stachethemes_ec.php and after line 157 add:

    $stachethemes_ec_main->add_front_js("stec-google-maps-cluster", "//developers.google.com/maps/documentation/javascript/examples/markerclusterer/markerclusterer.js");

    So it looks like this:

    if (Settings::get_admin_setting_value('stec_menu__general_other', 'load_gmaps') == '1') {
         $stachethemes_ec_main->add_front_js("stec-google-maps", "//maps.googleapis.com/maps/api/js?key=" . Settings::get_admin_setting_value('stec_menu__general', 'gmaps_api_key'));
         $stachethemes_ec_main->add_front_js("stec-google-maps-cluster", "//developers.google.com/maps/documentation/javascript/examples/markerclusterer/markerclusterer.js");
    }


    3) No, sorry.


    Stachethemes Developer

  • dovetaildesign replied

    Thanks so much for this. I'm just having a little bit of trouble though - where exactly do I put the code at 4086? Tried it in a few places and it doesnt seem to be working:

    $.each(events, function (i) {
                                var event = this;
                                if ($.trim(event.location).length > 0) {
                                    if (i == 0) {
                                        if (event.location_forecast) {
                                            parent.location = event.location_forecast.split(',');
                                            parent.focusLocation(null, parent.location);
                                        } else {
                                            parent.focusLocation(event.location);
                                        }
                                    }
                                    var locationString = event.location;
                                    if (!event.location_forecast) {
                                        parent.getCoordinates(locationString, function (coords) {
                                            if (coords !== false) {
                                                event.location_forecast = coords.toString().replace(/\(|\)/gi, '');
                                                parent.addMarker(event);
                                            }
                                        });
                                    } else {
                                        parent.addMarker(event);
                                    }
                                }
                            });
                            
                            var markerCluster = new MarkerClusterer(parent.gmap, parent.markers, {imagePath: 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m'});
                            
                        },
    

    and

    $.each(events, function (i) {
                                var event = this;
                                if ($.trim(event.location).length > 0) {
                                    if (i == 0) {
                                        if (event.location_forecast) {
                                            parent.location = event.location_forecast.split(',');
                                            parent.focusLocation(null, parent.location);
                                        } else {
                                            parent.focusLocation(event.location);
                                        }
                                    }
                                    var locationString = event.location;
                                    if (!event.location_forecast) {
                                        parent.getCoordinates(locationString, function (coords) {
                                            if (coords !== false) {
                                                event.location_forecast = coords.toString().replace(/\(|\)/gi, '');
                                                parent.addMarker(event);
                                            }
                                        });
                                    } else {
                                        parent.addMarker(event);
                                    }
                                }
                                
                                var markerCluster = new MarkerClusterer(parent.gmap, parent.markers, {imagePath: 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m'});
                            });

    Neither are working. 

    Thanks so much for your help I really appreciate it

  •  878
    Zhivko replied

    I've attached the files for you.


    Place stachethemes_ec.php in \stachethemes_event_calendar\shortcodes\stachethemes_ec.php

    stec.js file in stachethemes_event_calendar\front\js\stec.js

    Additional note: make sure to provide location coordinates because it seems the clusterer works only with coordinates. 

    Screenshot attached (coords.jpg).


    Stachethemes Developer