Skip Navigation

[Resolved] ACF map not reloading in content template with AJAX

This support ticket is created 7 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 10 replies, has 3 voices.

Last updated by Shane 7 years, 1 month ago.

Assisted by: Shane.

Author
Posts
#577303
Page refresh.png
AJAX.png

Hi,
I have an ACF google map in a content template used in a view with a parmetric search. The map is put there with a shortcode. But it's not reloading when using the AJAX parametric search. All I see is the adress. (For different reasons I can't use the Toolset Maps plugin. An upgrade from you guys is on it's way but it seems to take ages.)

I suspect I need to put some js code somewhere, but I'm not sure how to do it and where to put it. (Maybe something like this: https://toolset.com/forums/topic/reload-map-after-ajax-pagination/#post-364706)

This problem occurred when solving another content template AJAX issue. (https://toolset.com/forums/topic/beaver-builder-integration-ajax-search/)

Thank you

#577371

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Mat,

Thank you for contacting our support forum.

Indeed a callback function is needed for the ACF map. What I recommend that you do is to contact the support team for ACF to see if they have a function that can be used to manually reload the map.

If they do then we can add it to our views callback functions.

Thanks,
Shane

#578454

Hi Shane,

this is the answer I got from the ACF support:

"The issue looks like you are not initializing the google map JS for your new DOM elements (when you update the page with new HTML).

Please be sure to debug your code and understand how the google maps are initialized.
I won't be able to 'fix' this issue for you, because the problem is not with ACF, but with your custom theme code."

#578553

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Mat,

Is there any particular reason why you are using this custom map and not our toolset maps plugin ?

Our toolset maps plugin would be a better solution for this since the map will automatically refresh.

Thanks,
Shane

#578750

Hi Shane,
Yes it's described here.
https://toolset.com/forums/topic/maps-sddress-field-autocomplete-problems/page/2/
Any news on the 1.5 maps release date?

Regards
Mats

#579189

Hi, Shane is out today but will return tomorrow with an update for you. Thanks for your patience.

#579598

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Mats,

I understand what you mean now and see that you're currently working with the non-ajax approach.

However Having the callback for the ACF map or the function that initializes the map would be really helpful.

I can investigate it further but I can't promise i'll be able to find the function. Would you mind providing me with the name of the view that is doing the search.

Thanks,
Shane

#579855

Hi Shane,
yes, the view is called "resultatvy".

Thanks
Mats

#579939

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Mats,

Unless ACF team is able to provide a callback function to render the map, there isn't much we can do. The maps still work with the normal reload and I see that we are going to add the address autocomplete in 1.5

So some compromise needs to be done here.

Thanks,
Shane

#580522

Hi Shane,

reply from Elliot:

"Thanks for the reply.
I believe there is some misunderstanding about the issue.

The issue is with the 'front end' of your website (not the backend).
ACF is not rendering any maps on this page (hidden link).

I am aware that you have google maps on this page, but this will be rendered using some custom code.
I'm not sure if you have found this custom code on the ACF google map documentation page, or if you found this code elsewhere.

You will be the person who knows how the google map is being initialized (or your web developer). You will need to pass this informatino onto to Toolset developers.
I would like to help further, but I really can't, because my code is not rendering these maps.

Thanks,
Elliot
support@advancedcustomfields.com"

Regards
Mats

#580705

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Mats,

That is strange as the map was created using ACF.

The only thing we can do here is to do a page refresh to allow this to work since we dont know what the callback function is to re-initialize

Thanks,
Shane