Adding Content to the Modern Marker Listing Marker View

New home Forums Gold Add-on General queries Adding Content to the Modern Marker Listing Marker View

This topic contains 6 replies, has 3 voices, and was last updated by  mewvn 4 weeks ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #52962

    Hi there.

    I am trying to add some content via a JS API call to the listing view for each marker on our map and for the life of me I can’t locate the file that creates that content and make a change take effect.

    Can you point me to the file that I should edit to add some custom content to the single marker view in the modern marker listing?

    I have the free, pro and gold versions installed.

    Thanks in advance for your help.

    #52971

    Perry
    Moderator

    Hi there

    Thank you for getting in touch.

    Can we please ask what content you are trying to add? We might be able to suggest a better approach.

    If you want to use JS then you can bind to the event markerlistingupdated.wpgmza on any ancestor element, event.target refers to an instance of WPGMZA.MarkerListing in this context. You can get the marker listings element from event.target.element.

    Does that help?

    Kind regards
    – Perry

    #53164

    Thanks for getting back to me Perry.

    I have a number that I need to display as a near real-time value (similar to an inventory count for a product) and it comes from a 3rd party API endpoint.

    I don’t really want to store it since it changes regularly.

    I was planning on using some custom JS to make the call, parse the response and display the number in the popout panel list and marker when it is loaded.

    If you have a better idea – I’m more than happy to listen 🙂

    #53168

    Perry
    Moderator

    Hi Amy

    That sounds perfect, you can use markerlistingupdated.wpgmza for the listing itself, for the infowindow popout you can bind to infowindowopen.wpgmza

    Assuming your source data objects have some kind of ID that you need to map to our marker IDs, I would suggest perhaps using custom fields to store the remote ID so you have some kind of association there (rather than hard coding that)

    The native marker ID’s are available on each list item.

    If you need to work with the markers directly (eg to access their custom field data) you can do so by using WPGMZA.getMapByID to obtain a reference to your map, then you can call getMarkerByID on the map to retrieve markers. Custom field data as well as the other fields will be available to you through this marker object.

    Does that help?

    Kind regards
    – Perry

    #53197

    That helps a lot. Thanks!

    I already have the IDs in a custom field so it’s good to know we’re on the same page.

    #53201

    Perry
    Moderator

    Hi Amy

    You’re very welcome!

    Is there anything else we can help you with?

    Kind regards
    – Perry

    #53585

    mewvn
    Member

    Thanks you!!
    MEW

    • This reply was modified 4 weeks ago by  mewvn.

    All about Pets #1 VietNam
    https://mew.vn/

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

You must be logged in to reply to this topic.