• Resolved nghtmre

    (@nghtmre)


    Hello,

    I automatically import job descriptions via an RSS feed.
    Along with this RSS feed are longitude and latitude.

    However when I import these job descriptions does it give me this error in the console?

    I do not understand why ?

    Do you have an idea ?

    I thank you in advance.

    Cordially

    Uncaught TypeError: Cannot read properties of null (reading 'latitude')
        at cttmMapLoop (travelersmap-bundle.js:341:54)
        at Array.forEach (<anonymous>)
        at initTravelersMap (travelersmap-bundle.js:172:29)
        at HTMLDocument.<anonymous> (travelersmap-bundle.js:568:5)

    This error causes the map not to display

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Camille V

    (@socrapop)

    Dear @nghtmre,

    Travelers Map is saving the metadata of each post in a single and concatenated json string in the database.

    I don’t know how you imported your posts, but I think that might be the problem. Travelers Map saving functions are launched on post save, and they are compacting all the data into one row in the database :
    The metadata is named _latlngmarker and is made of :
    compact('latitude', 'longitude', 'markerdata', 'customtitle', 'customexcerpt', 'customthumbnail', 'customanchor');
    (You can find this in travelers-map\includes\admin\cttm-admin.php)

    Then on post save, the metadata is saved :
    update_post_meta($post_id, '_latlngmarker', $markers_json_array);

    Also, a private taxonomy is set on each post with a marker (and removed when markers are deleted), this is used by the plugin to fetch only the posts with a marker (for query speed optimization) :

    // add terms in private taxonomy
    wp_set_post_terms($post_id, 'hasmarker', 'cttm-markers-tax', false);

    So maybe you deleted manualy some marker metadata without deleting the private taxonomy. And the plugin is fetching the posts, but they don’t have any metadata so an error is appearing.

    It’s hard to help you without knowing what you have done with your custom RSS import, but I tried to summarize how Travelers map is working.
    Also you can check on the plugin code to try to understand, the saving functions are in \travelers-map\includes\admin\cttm-admin.php.

    The error you get is in \travelers-map\includes\public\js\dist\travelersmap-bundle.js line 341, you could console.log() here to see what markerdata you get.

    Thread Starter nghtmre

    (@nghtmre)

    Hello,

    Thank you for your investment and your response.

    I will study that.

    Really thank you.

    Cordially.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Display error’ is closed to new replies.