Show and Hide Basic Table

New home Forums Pro Add-on General queries Show and Hide Basic Table

This topic contains 11 replies, has 2 voices, and was last updated by  Dylan 2 years, 10 months ago.

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #23205

    hutchm
    Member

    Sorry if this is a repeat found something similar but did not see a solution or No.

    I would like for the Marker Listings Basic Table to only display when someone searches for a store near them showing only the paces found (as it does now when a search is done).

    So before search marker listings do not show after search only places found in the radius selected show.

    I tried setting the wpgmza_marker_list_class to display none and then doing a jQuery show on it in core.js but probably have it in the wrong place or something else is overriding it.

    Thanks

    #23214

    Dylan
    Moderator

    Hi there,

    Dylan here from the development team.

    This is not supported by default, however as you mentioned this can be achieved by making some changes to the code.

    I would be more than happy to walk you through this in more detail?

    Or alternatively, I would be happy to add this on your behalf?

    #23223

    hutchm
    Member

    Hi Dylan, Thanks for getting back with me. I’m comfortable with making PHP and jQuery/javascript changes so if you could walk me through in detail that would be great.

    #23227

    Dylan
    Moderator

    Hi there,

    Not a problem at all, happy to help.

    Firstly we will need to make some changes to the wpgmza.php file (wp-google-maps-pro/wpgmza.php). Specifically we will need to find the following line: (Line: 435 Approx.)

    
    $wpgmza_tmp_head .= "<div id=\"wpgmza_marker_list_".$map_id."\" class=\"wpgmza_marker_list_class\" style='width:".$width.";'>";
    

    And change it to this instead:

    
     $wpgmza_tmp_head .= "<div id=\"wpgmza_marker_list_".$map_id."\" class=\"wpgmza_marker_list_class\" style='width:".$width."; display:none;'>";
    

    Note: This will only affect marker listing type 1 – Basic Table

    As you can see above we added some inline styling to hide the table (display:none;), jQuery can alter inline styles with ease.

    Now that we have done this we will need to change the following in the core.js file (wp-google-maps-pro/js/core.js): (Line 242 Approx)

    
    function searchLocations(map_id) {
    

    To this instead:

    
    function searchLocations(map_id) {
      jQuery('.wpgmza_marker_list_class').show();
    

    If I have not missed something, this should do the trick.

    Please let me know if you run into any issues though.

    #23244

    hutchm
    Member

    Hi Thanks, But…

    Added the code, see attachments. When I do the search it displays the listing for about 3 seconds then it hides. There is a second division wpgmza_marker_list_class with display none added within the first wpgmza_marker_list_class Parent – Child, before and afters attached. I did some greps trying to figure out where it was generated but only found what was added to wpgmza.php. Suspect there is an Ajax call that is adding the additional wpgmza_marker_list_class division. Just because it is a duplicate of the first div and I did not find that string anywhere else.

    Attachments:
    You must be logged in to view attached files.
    #23249

    hutchm
    Member

    Sorry, Forgot I did find the wpgmza_marker_list_class in wp-google-maps-pro.php but it does not have the display none in the <div.

    #23278

    Dylan
    Moderator

    Hi there,

    Please note that the code changes I mentioned (for the structural HTML segments) need to be changed in the ‘wpgmza.php’ file, not the wp-google-maps-pro.php

    Could I ask you to revisit this file and confirm if you were able to apply all the changes?

    #23279

    hutchm
    Member

    Hey, Yes the changes were made in wpgmza.php and core.js not wp-google-maps-pro.php. Just mentioned it because that was the only other place I found the wpgmza_marker_list_class.

    Was trying to find where the second division with wpgmza_marker_list_class display none was coming from.

    Guess the images uploaded did not help.

    I really appreciate your help with this.

    #23280

    hutchm
    Member

    Looked at previous message looks like the images did not upload. So here are the changes I made.

    wpgmza.php

    if ($type == 1)
    ` /* $wpgmza_tmp_head .= “<div id=\”wpgmza_marker_list_”.$map_id.”\” class=\”wpgmza_marker_list_class\” style=’width:”.$width.”;’>”; */

    $wpgmza_tmp_head .= “<div id=\”wpgmza_marker_list_”.$map_id.”\” class=\”wpgmza_marker_list_class\” style=’width:”.$width.”; display:none;’>”;

    <strong>And core.js</strong>

    function searchLocations(map_id) {
    	jQuery('.wpgmza_marker_list_class').show();
        if (document.getElementById("addressInput_"+map_id) === null) { var address = null; } else { var address = document.getElementById("addressInput_"+map_id).value; }
        if (document.getElementById("nameInput_"+map_id) === null) { var search_title = null; } else { var search_title = document.getElementById("nameInput_"+map_id).value; }

    Hope that helps.

    • This reply was modified 2 years, 10 months ago by  hutchm.
    • This reply was modified 2 years, 10 months ago by  hutchm.
    #23296

    Dylan
    Moderator

    Hi there,

    Thank you so much for clarifying the changes made, and my apologies for the misunderstanding.

    Perhaps the best way to approach this would be to hide the listing when the page is loading, using some jQuery instead.

    Please try adding the following line of code to the core.js:

    jQuery('.wpgmza_marker_list_class').show();
    

    This should be added right below the following:

    jQuery(document).ready(function(){
    

    Please let me know if this helps?

    #23301

    hutchm
    Member

    You are the man!! Thanks for sticking with this.

    I removed the display none from wpgmza.php program and added
    jQuery('.wpgmza_marker_list_class').hide();
    as directed to core.js

    Works like a charm.

    Thank You Dylan!!

    #23304

    Dylan
    Moderator

    Only a pleasure, always happy to help! 🙂

    So glad to hear that did the trick. Please let me know if you need anything else in future.

    Have a good one.

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

You must be logged in to reply to this topic.