cyberhobo / wordpress-geo-mashup

Official repository for Geo Mashup, the plugin that makes WordPress into a GeoCMS. Documentation:
https://github.com/cyberhobo/wordpress-geo-mashup/wiki/Getting-Started
63 stars 15 forks source link

TypeError: term_properties[taxonomy].terms[term_id] is undefined #838

Closed FranckLetellier closed 5 years ago

FranckLetellier commented 5 years ago

Hello,

I have been working with Geo masher for quite some time and the global maps was always working.

I updated to Wordpress 5 (plus my plugins and so on, and of course updated Geo mashup) and now the global map is here but does not display any pins.

You can find a working test here : https://www.iwheeltravel.com/ou-aller/ where I put my short codes before the actual code. You can see that all the post are indeed located, but not displayed on the local map.

Do you have any idea as to how this has happened?

I have tried different maps provided (google, openLayer) but the result is the same

Thanks

cyberhobo commented 5 years ago

The console error is

TypeError: term_properties[taxonomy].terms[term_id] is undefined taxonomy.min.js:246

It looks like the data contains a category for which there is no color defined. Intended behavior is to use a default color in this case, hopefully an easy fix.

In the meantime, re-saving your category color assignments in the settings might get you up and running again.

FranckLetellier commented 5 years ago

Ok thanks for the tip 👍

FYI, I tried re-saving category colors, and if I open the console, I get this error now :

Uncaught TypeError: Cannot read property 'color' of undefined
    at Object.term_manager.extendTerm (taxonomy.min.js?ver=1.11.5:1)
    at Object.addObjects (geo-mashup.min.js?ver=1.11.5:1)
    at Object.GeoMashup.createMap (geo-mashup-mxn.min.js?ver=1.11.5:1)
    at ?geo_mashup_content=render-map&map_data_key=03ee727b74e8a0ab275ee05b60c3cf9f&lang=fr&map_content=global&name=gm-map-1&object_id=277:36
cyberhobo commented 5 years ago

Hmm. The category ID that triggers the error is 435. I wonder if that could be a deleted category or some kind of edge case like that. I can fall back to the default regardless, but it might be good to know what happened with that category.

FranckLetellier commented 5 years ago

Interesting. I've look into the database, 435 seems to be the category "United Kingdom" (https://www.iwheeltravel.com/en/category/destinations-en/europe-en/united-kingdom/) and it is one of the last one I added on the site. I'm going to check if we did everything right.

Edit: This is the english category (the site has english and french posts), but I do not add any location for english category. The global map is only on the french version of the site.

FranckLetellier commented 5 years ago

Ok I found it! Usually, for each category I have a translated category (using WPML). I made a mistake when creating the "united kingdom" category. Indeed I created a separated category for the english version, rather than a translation. I've corrected it (deleted the old english category, and translated the french version, using WPML) and now global map is back on!

So it was kind of an edge case. Hope it helps to fix the issue in code.