Show marker categories in basis table

New home Forums Pro Add-on Show marker categories in basis table

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #75533
    Broemmelhaupt
    Participant

    Hey,
    is there an possibility to add the marker categorys into the basic table?
    I would like to show it right of the other data (see attached file).
    Or is it possible to show the marker picture in advanced table?
    Either way, I am lokking for a solution to show the picture an the categories of a marker in the listing.
    Best Regards
    Sebastian

    Attachments:
    You must be logged in to view attached files.
    #75581
    Matthew
    Moderator

    Hi Sebastian,

    Thank you for getting in touch with us, we do appreciate your time.

    Displaying the category name in the basic table may be possible using some custom JS code, thus please may I ask if can provide me with the link to your map so that I may take a closer look and confirm if this is indeed possible?

    I look forward to hearing back from you.

    Kindest Regards,
    Matthew

    #75583
    Broemmelhaupt
    Participant
    This reply has been marked as private.
    #75642
    Broemmelhaupt
    Participant

    Matthew, are you there? 😉

    #75649
    Matthew
    Moderator

    Hi Sebastian,

    Thank you for your response and my apologies as it appears I had missed your response on the 1st.

    Thank you for the link, thus please see the below code to display the category names for each marker in their respective listings:

    jQuery(function($){
        $(document).on('markerlistingupdated.wpgmza', function(){
            let map = WPGMZA.maps[0];
    
            $('.wpgmaps_mlist_row').each(function(){
                let row = $(this);
                let mid = row.attr('data-marker-id');
                let marker = map.getMarkerByID(mid);
    
                let categories = marker.categories;
                let categoryNames = [];
                for(let cid of categories){
                    let category = WPGMZA.categories.getCategoryByID(cid);
                    categoryNames.push(category.name);
                }
    
                let categoriesString = categoryNames.join(', ');
                
                $(<code><div class=&quot;wpgmza-cats&quot;><p>${categoriesString}</p></div></code>).insertAfter(row.find('.wpgmza-desc'));
            })
        })
    })

    Please may you copy, paste and save the above JS code into the “Custom JS” setting block (Maps -> Settings -> Advanced Settings)?

    Once this has been done, please may you clear your browser cache and confirm if this helps?

    Should you want some spacing at the top of the category string, you may save below CSS code into the “Custom CSS” setting block (Maps -> Settings -> Advanced Settings):

    .wpgmaps_mlist_row .wpgmza-cats {
        margin-top: 25px;
    }

    I hope this helps?

    I look forward to hearing back from you.

    Kindest Regards,
    Matthew

    #75650
    Broemmelhaupt
    Participant

    Hi Matthew,
    thank you for your feedback.
    Unfortunately the code does not work.
    Do I have to activate something else in the settings?
    Best Regards,
    Sebastian

    #75667
    Matthew
    Moderator

    Hi Sebastian,

    Thank you for your response and my apologies for that, it appears that some of the quotes changed into a bbcode in the forum, and thus is incorrect.

    With that said, please may you use the following code found within my following Gist link and confirm if this helps: https://gist.github.com/MatthewCodeCabin/9813603273401ede25d2e3155574d868

    I look forward to hearing back from you.

    Kindest Regards,
    Matthew

    #75674
    Broemmelhaupt
    Participant

    Hi Matthew,
    perfect. That worked for me. Thank you. Great work.
    One last request: could you please display the sub categories seperate without the top categories?
    For example: the top categories are “Marken” and “Services”.
    They do not have to be displayed within the subcategories.
    For us it is important to display the rows with the just the respectively subcategories.
    Row 1: just the subcategories of “marken” in alphabetical order
    Row 2: just the subcategories of “services” in alphabetical order
    Row 3: …
    I can include the top categories per css.
    Thank you in advance.

    Best Regards,

    Sebastian

    #75715
    Broemmelhaupt
    Participant

    Hi Matthew,
    do you need further information?
    I apologize if I have been not precise enough in my previous post?
    Best Regards,
    Sebastian

    #75726
    Matthew
    Moderator

    Hi Sebastian,

    Thank you for getting back in touch, yes sure thus please see my updated Gist which will display the parent category as well as the assigned children categories: https://gist.github.com/MatthewCodeCabin/9813603273401ede25d2e3155574d868

    Please do let me know if this helps?

    I look forward to hearing back from you.

    Kindest Regards,
    Matthew

    #75727
    Broemmelhaupt
    Participant

    Hi Matthew,
    thank you for the code.
    Unfortunately it does not work.
    Best Regards,
    Sebastian

    #75763
    Matthew
    Moderator

    Hi Sebastian,

    Thank you for your response and time on this.

    My apologies as it appears that the code was missing an event listener. Thus please may you try the updated code in the Gist and confirm if this helps: https://gist.github.com/MatthewCodeCabin/9813603273401ede25d2e3155574d868

    I look forward to your response.

    Kindest Regards,
    Matthew

    #75768
    Broemmelhaupt
    Participant

    Hi Matthew,
    thanks again for the code.
    Unfortunately I do not see any changes.
    Best Regards,
    Sebastian

    #75833
    Broemmelhaupt
    Participant

    Hi Matthew,
    did you have time to look over the code again?
    Best Regards,
    Sebastian

    #75847
    Matthew
    Moderator

    Hi Sebastian,

    I have taken a further look at your site and it appears that the code is not being executed.

    It appears that you have a JavaScript error on the page which you may see in the JavaScript Console (F12) which appears to be caused by some custom code implemented on your page from another plugin.

    With that said, please may you resolve that error as this may be causing the JavaScript engine to fail and thus cause proceeding scripts to fail and not work as expected?

    I look forward to hearing back from you.

    Kindest Regards,
    Matthew

Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.