Skip Navigation

[Resolved] Map don't load if one of the posts is not well filled (2)

This support ticket is created 6 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 23 replies, has 2 voices.

Last updated by Nigel 6 years, 1 month ago.

Assisted by: Nigel.

Author
Posts
#1097874

Hello,
The CPT is here : hidden link
It has been setup thanks to hidden link
It worked fine untill a few months...
Thank you.
https://toolset.com/forums/topic/map-dont-load-if-one-of-the-posts-is-not-well-filled/

#1098417

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi there

Sorry, it is not clear from your question what the issue is.

I looked at the previous ticket and it appears no progress was made.

I understand there is a map that is not working.

1. Which is the View that generates the map?

2. What do you expect to see on that map and what do you actually see?

3. What is an example of a correct post and what is an example of an incorrect post?

I'll need to see your site, so I will mark your next reply as private.

You may want to create a temporary admin user for me to use that you can later delete. And be sure to have a current backup of your site, even though I don't intend to make any changes.

#1102426

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

When I go to the page Toolset > Settings > Maps on your site and use the Check API button it reports that the request is denied, which is why your maps are not working.

If the map worked before and has stopped working it may be because of API changes Google introduced over the summer.

You should first check your API key and the URL referrer restrictions. If these appear to be correct and the markers still do not display, you may need to add a second, unrestricted, key as described here: https://toolset.com/documentation/user-guides/display-on-google-maps/creating-a-google-maps-api-key/#problems-with-displaying-markers-on-google-maps

#1102427

Hello and thank you,
I have just done that with no success.

#1102552

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

I took a closer look at the map and see it is a little unusual, the markers not coming from address fields but from fields that include the latitude and longitude.

The post type seems completely invisible in the backend, it must be registered by your theme or a plugin with settings to exclude it from the UI, so I can't edit the posts to check the entries for coordinate custom fields.

I am taking a copy of the site to install locally so that I can take a better look at it.

I'll let you know what I find.

#1102556

The custom post is under /wp-admin/edit.php?post_type=tribe_venue
Thank you.

#1104557

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

I installed the copy of your site locally and as with normal debug steps I disabled non-essential plugins (i.e. all except Toolset and the Events Calendar plugins), and the map appeared to work correctly, although I did note a series of JS warnings and errors in the console.

I was unable to determine what the root cause of the issue is, and I've passed this on to my colleagues who will be able to dedicate more time to investigate the problem.

I'll update you when I have some feedback from them.

#1108402

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Roman

We cannot fully debug this because The Events Calendar is loading the Google Maps libraries as well as Toolset, which is creating errors.

The Events Calendar has a setting to disable Google Maps (at Events > Settings > General), but it doesn't work. The Events Calendar still adds the Google assets regardless, which is causing errors.

On my local copy of your site, if I disable the Events Calendar plugins and then recreate the tribal_venue post type using Types, then the map displays without any errors.

Can you please contact them and try to resolve the issue that they are force-loading Google Maps even when it has been disabled in their own settings.

If that is resolved and we still see a problem then we will be able to investigate further.

#1108461

Well, this really would be a problem since I do use their google maps too... On at least several pages, I need theirs to work ; so even deactivate it wouldn't be a solution.
Thank you.

#1109476

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

To get round the errors I see on your site I tried to set up a View to show Events Calendar venues on a map on a local test site.

In your View you get the lat and lon coordinates for the markers from hidden custom fields _VenueLat and _VenueLng.

On my test site there are no such fields created.

So I went back to your live site and looked in the database in the wp_postmeta table for one of your Venues ("Centre cardianal paul zoungrana") and there are no such custom fields.

So the venues cannot be displayed on the map because the specified source doesn't exist.

I'm not sure why you expect the Venue posts to have these custom fields, because on the site I created to test this no such fields are created.

#1109489

The fact is it worked great before. And it doesn't anymore. I can't say why, nore even when the view was broken.
On this page : /wp-admin/admin.php?page=toolset-settings, I have added the custom fields, thanks to the "select custom fields" button.
Some of the venues are not filled correcly, some are, as you may see here : /wp-admin/post.php?post=2271&action=edit
Thank you.

#1109502

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

OK, so can I just clarify what exactly you expect to happen.

You have a View listing venues, some of which have location coordinates, some of which do not.

You want the map to display those venues which have coordinates, and ignore those that don't?

#1109504

Thank you.
Yes that's it, precisely. I tried to say this in my very first post (previous topic) : "as soon as one place is not well filled, the places aren't loaded anymore, even the ones with correct addresses."
Thank you.

#1110687

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

I have stripped back the local copy of your site I have installed to the bare minimum, using twentyseventeen, Types, Views and Maps, plus the Events Calendar and Events Calendar Pro plugins.

I have created a new View to display venues with no filters and very basic output, with the markers taking the lat and lon values from the Events Calendar hidden fields.

In parallel I also have a clean Maps test site where I have added the Events Calendar plugins and created sample venue data, and set up a View similar to the copy of your site.

On my local test site everything works as expected, there are no errors, and if I have several venues and one of them is missing location coordinates, the other markers are displayed on the map.

On the copy of your site the same thing doesn't work correctly at all, instead there are JS errors which begin with the warning that the API is being loaded multiple times on the page (see screenshot).

I repeat, I don't see the same on my own test site, only on your site, even though I have modified your site so that it has essentially the same set up.

I need to pass this to a colleague to see if they can spot something that I cannot.

Note that, when preparing a duplicate of the slimmed down version of your site I noticed that the database size was very large. Checking, I found very many tables, including tables for WooCommerce, for example, which isn't even installed on this site. It looks like lots of plugins have been tried out on this website during development which have left their footprint even though they are no longer used, which complicates the debugging process enormously.

I deleted such tables and it made a difference to my simple View of venues, which previously showed no markers, and now show all of the available markers. That sounds like it may be part of the problem, but, I still saw the same JS errors in the console which I cannot account for (because they don't appear on my test site which has a similar set up).

Note I couldn't use Duplicator, which we normally use, it choked on your site even after deleting the redundant database tables, and I had to use an alternative.

#1110690

Thank you very much for this very complete answer.
I would very much like to delete those tables, but don't really know how to proceed to be certain they're not used by any plugin.
I also will wait for your collegue's point of view in order to solve the main problem.
Many thanks again.