Skip Navigation

[Résolu] Markers from repeatable field group not being shown properly on map

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem: I have a repeating field group that contains address fields. I would like to show all the addresses on a map using markers, and I would also like to show the addresses as text. Some of the markers are not appearing on the map, and some addresses do not show up in text.

Solution: Check the custom field slugs, in this case a slug from a different custom field was used, causing problems.

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.

This topic contains 6 réponses, has 2 voix.

Last updated by Sasank Il y a 3 années.

Assigned support staff: Christian Cox.

Auteur
Publications
#953582
think3d markers.PNG
markers.PNG
think3d fields.PNG
smart3dme fields.PNG
locations loop.PNG

I have a repeatable field group with fields city name and address for company listing. I want to show list of locations of the current company and place maker on the map of that location. I created a view for repeatable group which passes city name, address and marker. When I use the view on the company page makers from other company are also being placed and also I am not able to get the city name and address as text displaced,
hidden link
hidden link

Also, How do I show all the locations on archive page? Each company can have multiple locations. hidden link

#953639
think3d.jpg

I figured out I had to add post relationship filter in view. Now markers are being placed correctly. But, not able to get address text properly displaced. The 1st address in the field group is missing!

I have the sorting set to city field, how do I sort as per the order of the fields in post? not the text or id

#953774

Christian Cox
Supporter

Languages: Anglais (English )

Timezone: America/New_York (GMT-04:00)

Screen Shot 2018-07-23 at 1.02.33 PM.png

The 1st address in the field group is missing!
It looks like the address field is working for the Marker, but not for the basic text display. I think it's because you have used the item=$current_page operator here:

[types field="branch-address" item="$current_page"][/types]

I think that should be removed, because the branch-address field is not part of the Company post ($current_page), it is part of the current RFG in the Loop. So the correct code should be:

[types field="branch-address"][/types]

how do I sort as per the order of the fields in post?
In the Order By settings for this View, you will find an option "Field - toolset-post-sortorder". This will sort the View results by the order of the RFGs in the post. See the screenshot.

Also, How do I show all the locations on archive page?
First you must create a View of all Company posts. In the Loop Output of this View, insert a View of the locations RFG, filtered by post relationship, where the post parent is the current post in the Loop. In the Loop Output of this View, insert the Marker shortcode. You can insert the Map shortcode in the WordPress Archive for this page, or in the View of Company posts outside the Loop. If you need more information about this, please create a separate ticket so we can discuss the details.

#953905
smart3dme address field.JPG
think3d address missing.JPG
think3d address fields.jpg

Thanks for your reply. Sorting is working well after setting it to "Field - toolset-post-sortorder".

I did remove item="$current_page" from it after which the city and address showed up. I did double check the address fields all fields are fill properly as you can see in the screenshots. Few addresses are being skipped and even their markers are not being shown. I deleted the filed and re-enter the address but still didnt fix the issue.

It is happening with both listings I have on site right now,
hidden link
hidden link

I have code for loop as below,

Loop

[wpv-layout-start]
   [wpv-items-found]
	<!-- wpv-loop-start -->
	<div class="container wpv-loop js-wpv-loop">
	<wpv-loop wrap="4" pad="true">
		[wpv-item index=1]
		<div class="row ">
			<div class="col-sm-3">[wpv-post-body view_template="Loop item in Company Locations"]</div>
		[wpv-item index=other]
			<div class="col-sm-3">[wpv-post-body view_template="Loop item in Company Locations"]</div>
		[wpv-item index=4]
			<div class="col-sm-3">[wpv-post-body view_template="Loop item in Company Locations"]</div>
		</div>
		[wpv-item index=pad]
			<div class="col-sm-3"></div>
		[wpv-item index=pad-last]
			<div class="col-sm-3"></div>
		</div>
	</wpv-loop>
	</div>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
	[/wpv-no-items-found]
   [wpv-layout-end]

Template for this View

<h3>[types field="company-branch-city"][/types]</h3>
[types field="branch-address"][/types]

[wpv-map-marker map_id='map-1' marker_id='marker-[wpv-post-id]' marker_field='wpcf-branch-address']
  <h5>
    [types field='company-logo' title='[wpv-post-title item="$current_page"]' alt='[wpv-post-title item="$current_page"] Logo' size='custom' height='50px' resize='proportional' item='$current_page'][/types]
    [wpv-post-link item='$current_page']
  </h5>
  <i class="fa fa-map-marker"></i>  [types field='branch-address'][/types]<br/>
	<p><a href='<em><u>hidden link</u></em> item="$current_page"]&loc:[types field='branch-address' format="@FIELD_LATITUDE+FIELD_LONGITUDE"][/types]&z=15'>View on Google</a></p>
[/wpv-map-marker]

Even the latitude and longitude in the marker popup is not getting filled properly.

Will create different ticket for archive page as suggested

#954478

Christian Cox
Supporter

Languages: Anglais (English )

Timezone: America/New_York (GMT-04:00)

Few addresses are being skipped and even their markers are not being shown. I deleted the filed and re-enter the address but still didnt fix the issue.
This could indicate a caching problem. Please go to Toolset > Settings > Maps tab and click "Load stored data" in the Cached data section. Find the missing addresses here and click the "X" to delete them. This will force Google Maps to recalculate the fields. Check the front-end of the site again. If you still cannot see the markers or addresses for these Locations, turn off Views caching temporarily. If you inserted the Locations View using a shortcode, you can add cached="off" like this:

[wpv-view name="your-locations-view-slug" cached="off"]

If neither of these suggestions helps, I will need to take a closer look. Please provide login credentials in the private reply fields here.

#954657

Christian Cox
Supporter

Languages: Anglais (English )

Timezone: America/New_York (GMT-04:00)

Okay please check now. I believe there was a problem with the custom field slugs. The correct slug is "company-branch-address", but the slug that was in place was "branch-address". Not sure why there are two similar slugs, but the markers and addresses are showing up now. Can you confirm?

#954689

Ah ha thanks Christian.
I was always prepended company to slug every time but somehow missed for this field and this itself created problem lol. Like you said, strange part is how there is another slug with branch-address name in wordpress!