Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • yiotaz Friend
    #1035051

    I have found where to add my code for that but I need the plugin override to work. So I have the following questions:

    1) Can you let me know how I can make this work?
    2) Do you happen to have an idea on how to extend the JAWidgetMap class and add a new method in the view file instead of having to mess with the script.js file itself?
    3) Where can I set a default address when the map loads for the first time?

    Thank you

    Mo0nlight Moderator
    #1035361

    Hi

    I’m looking at this, pls stay tuned.

    yiotaz Friend
    #1035442

    Sorry, I have a 4th question:

    On a multiple location map, when I click on a marker I see the info box. The problem I spotted is when I don’t close up this box and simply click on another marker. I also get its box opened so in my map I end up having all info boxes open if I don’t chose to close them up from the x button.
    How can I change that so when I click on each marker to just close the previous one and open the one I clicked?

    Here is an example: http://maps.marnoto.com/en/multiple-markers/example.html

    Thank you
    Yiota

    yiotaz Friend
    #1036021

    Any news on the above please?

    Thank you
    Yiota

    Anonymous Moderator
    #1036537

    @yiota : The team is still checking for you at the moment, pls give us more time to prepare a proper answer.

    Mo0nlight Moderator
    #1037631

    Hi.

    1. If you want to center the map with all the pointer inside. Edit the file : /plugins/system/jagooglemap/assets/script.js

    Look for :

            for(var i in locations.location) {
                var location = locations.location,
                    latitude = locations.latitude.toFloat(),
                    longitude = locations.longitude.toFloat(),
                    info = locations.info,
                    icon = null;
                if(typeof locations.icon != 'undefined') {
                    icon = locations.icon;
                }
    
                if(this.isLatLon(latitude) && this.isLatLon(longitude)){
    
                    this.showLocation2(latitude, longitude, info, icon);
                }else{
                    this.showLocation(location, info);
                }
    
                LatLngList.push(new google.maps.LatLng (latitude,longitude));
    
            }

    Change to :

            var LatLngList = new Array ();
    
            for(var i in locations.location) {
                var location = locations.location,
                    latitude = locations.latitude.toFloat(),
                    longitude = locations.longitude.toFloat(),
                    info = locations.info,
                    icon = null;
                if(typeof locations.icon != 'undefined') {
                    icon = locations.icon;
                }
    
                if(this.isLatLon(latitude) && this.isLatLon(longitude)){
    
                    this.showLocation2(latitude, longitude, info, icon);
                }else{
                    this.showLocation(location, info);
                }
    
                LatLngList.push(new google.maps.LatLng (latitude,longitude));
    
            }
            //  Create a new viewpoint bound
            var bounds = new google.maps.LatLngBounds ();
            //  Go through each...
            for (var i = 0, LtLgLen = LatLngList.length; i < LtLgLen; i++) {
              //  And increase the bounds to take this point
              bounds.extend (LatLngList);
            }
            //  Fit these bounds to the map
            this.objMap.fitBounds (bounds);
    1. Extend class JAWidgetMap. This one required heavy knowledge of program language. You should hire a programmer if you want to edit the plugin. You can see this link if you want to find out your self. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/extends

    2. I’m not entirely sure of what you want here, could you clarify it a bit more details?

    3. If you want to show only 1 detail info box at the time. Edit the file: /plugins/system/jagooglemap/assets/script.js

    Look for :

    var infowindow = new google.maps.InfoWindow({

    Change to :

    infowindow = new google.maps.InfoWindow({

    Add this :

    var infowindow;

    Above this :

    JAWidgetMap = new Class({
    yiotaz Friend
    #1037984

    Hello,

    Ideally I would like the plugin override to work so I won’t need to mess up with the core plugin and the script.js file.
    My plan was to extend the JAWidgetMap in that override and add/call my new method for the map without messing up with the core script.js file.
    Is there a way to do that?
    Do you know why the plugin override is not working?

    Thank you
    Yiota

    Mo0nlight Moderator
    #1038655

    Hi.

    As i mentioned above

    Extend class JAWidgetMap. This one required heavy knowledge of program language. You should hire a programmer if you want to edit the plugin. You can see this link if you want to find out your self. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/extends

    That all i could help you in this problem.

    yiotaz Friend
    #1038973

    OK the class extend part was clear enough but I am asking why the plugin override is not working. Do you have an answer about that please?

    Thank you
    Yiota

    Mo0nlight Moderator
    #1039793

    Hi.

    You could see this link for more info : https://docs.joomla.org/Understanding_Output_Overrides

    And i don’t think joomla support plugin override.

    yiotaz Friend
    #1040738

    https://docs.joomla.org/Layout_Overrides_in_Joomla#Plugin_Alternative_Layouts_.28Overriding_a_Plugin.29

    plus your code suggests so

    function getLayoutPath($plugin, $layout = 'default')
        {
    
            $app = JFactory::getApplication();
    
            // Build the template and base path for the layout
            $tPath = JPATH_BASE . '/templates/' . $app->getTemplate() . '/html/' . $plugin->name . '/' . $layout . '.php';
            $bPath = JPATH_BASE . '/plugins/' . $plugin->type . '/' . $plugin->name . '/tmpl/' . $layout . '.php';
            // If the template has a layout override use it
            if (file_exists($tPath)) {
                return $tPath;
            } elseif (file_exists($bPath)) {
                return $bPath;
            }
            return '';
        }

    Thank you

    Mo0nlight Moderator
    #1040874

    Hi.

    You should make the link like this. templates/template_name/html/jagooglemap/default.php

    to make the override work.

    yiotaz Friend
    #1040975

    That did the trick.

    Thank you very much for all your help.

    Yiota

Viewing 13 posts - 1 through 13 (of 13 total)

This topic contains 13 replies, has 3 voices, and was last updated by  yiotaz 6 years, 10 months ago.

The topic ‘JA Maps and search integration’ is closed to new replies.