Skip Navigation

[Resolved] Google Maps based on repeating fields group

This thread is resolved. Here is a description of the problem and solution.

Problem:
How to display repeating field group's field with google map and plot the marker for address stored in custom field.

Solution:
To pass the Address stroed in custom field, You need to adjust the value passed to map marker shortcode using the "address" field attribute.

For example:

[wpv-map-marker map_id="map-7" marker_id="marker-[wpv-post-id]" address="[wpv-post-field name='scuola_indirizzo-indirizzo']"][/wpv-map-marker]

You can find proposed solution, in this case, with the following reply:
https://toolset.com/forums/topic/google-maps-based-on-repeating-fields-group/#post-775399

Relevant Documentation:
https://toolset.com/documentation/user-guides/display-on-google-maps/

This support ticket is created 6 years, 7 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 10 replies, has 2 voices.

Last updated by antonioS-7 6 years, 7 months ago.

Assisted by: Minesh.

Author
Posts
#766697

Is there a way to use a custom field as a marker for a Google Map based on a repeating fields group?

I've created a repeating fields group and a view as described here: https://toolset.com/documentation/getting-started-with-toolset/creating-and-displaying-repeatable-field-groups/

Then, a map with this structure:

[wpv-map-render map_id="map-7"][/wpv-map-render]
[wpv-for-each field="scuola_indirizzo-indirizzo"]
[wpv-map-marker map_id="map-7" marker_id="marker-[types field="scuola_indirizzo-indirizzo"][/types]" marker_field="[types field="scuola_indirizzo-indirizzo"][/types]"][/wpv-map-marker]
[/wpv-for-each]

But it's not working. Can you help me?

"scuola_indirizzo-indirizzo" is a fields in "scuola_indirizzi" repeating fields group.

#767446

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - as I understand "scuola_indirizzo-indirizzo" is the field that holds the google map address correct? If yes:

Could you please try to use following code and try to resolve your issue.:

[wpv-map-render map_id="map-7"][/wpv-map-render]

[wpv-for-each field="wpcf-scuola_indirizzo-indirizzo"]
[wpv-map-marker map_id="map-7" marker_id="marker-[types field="scuola_indirizzo-indirizzo"][/types]" address="[types field="scuola_indirizzo-indirizzo"][/types]"][/wpv-map-marker]

[/wpv-for-each]

You need to use "address" attribute of marker shortcode to pass the address stored with your custom field scuola_indirizzo-indirizzo.

#768573
download (3).png
download (2).png
download (4).png
download (5).png

Hello Minesh, thank for your reply.

It is not working. I have these settings:

- A layout calling the view with a shortcode: [wpv-view name="scuola-sedi" scuola="[wpv-post-id]"]
- The "scuola-sedi" view with your code for the map (see settings in attachement)
- The field "scuola_indirizzo-indirizzo" is an "address" but in the post editor is working like a single line field;

What is going wrong?

#768610

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - have you tried to register the google map API key at:
=> Toolset => Settings => Maps tab => Google Map API key

If you registered the API key - please click on button "Check API" to check your API key is valid or not.

Also, do you see any javascript error/notice on your browser's console?

#768728
Cattura.PNG

API Key is fine and this is my console report.

PS: Other maps are working good.

#768730

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - I need problem URL and access details so that I can debug this issue further.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.

#768841

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Unfortunately - provided wp-admin access details not working at this end. Please share working wp-admin access details.

#769108

Sorry, my fault. Please, try now with the same credentials.

#769148

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - I see you are using the latest Release Candidate plugins and new repeating field groups.

Could you please share problem URL and view link so I can look at it further.

#775399

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Could you please check now.
=> hidden link

I've corrected your view's output here:
=> hidden link

And I can see not map is displaying.

I also change how map display the markers - I've activated "spiderfy" and "cluster":

[wpv-map-render map_id="map-7" cluster="on" spiderfy="on"][/wpv-map-render]
#775670

Great! Thank you Minesh!