Skip Navigation

[Resolved] Many to Many Relationship display brother fields in another post

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 6 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 -
- 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 11 replies, has 2 voices.

Last updated by Noman 6 years, 8 months ago.

Assisted by: Noman.

Author
Posts
#556013

Tell us what you are trying to do? Display brother custom fields in another post.
I have two parent posts Colleges & Consultants - with custom field of country in both

I have one child post of both -- Common

I have created two views as the instructions.

I want to display all the consultants belongs to particular college in college post type but with the option of country custom field as drop down so that I can find all the consultants in one country for the particular college.

Is there any documentation that you are following? Yes. https://toolset.com/documentation/toolset-training-course/part-9-many-to-many-relationships-in-toolset/

Is there a similar example that we can see?

What is the link to your site? hidden link

#556039

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Ram,

Thank you for contacting Toolset support. Looks like you want to create a Search view where user can filter the consultants using Country dropdown.

You can create Custom search view for Consultant Post type, please follow this doc:
https://toolset.com/documentation/toolset-training-course/part-7-custom-search/

More info: https://toolset.com/documentation/user-guides/filtering-views-by-custom-fields/

The requirements you have provided are not clear. Please provide us:
1. Step by step details of what you have done to at the back-end? (preferably with backend screenshots)
2. What you expected to see on the front page?

Thank you

#556344

Hi Noman

I referred to these 2 posts:
https://toolset.com/forums/topic/parametric-search-filtering-by-parent-types-field/
https://toolset.com/documentation/toolset-training-course/part-9-many-to-many-relationships-in-

toolset/

Here are the steps I taken:

Create Post Type College with Country as a custom field - Added some posts
Create Post Type Consultant with Country as a custom field - Added some posts

Create Post Type Common -- is a child of College & Consultants -- Created some relationship post
with colleges and consultants. I am able to display colleges using the Country custom field dropdown in college post and also consultant using the Country custom field dropdown in consultant post. I am also able to display all consultants for particular college and all colleges for particular consultant but wanted to filter by country dropdown.

I have created 2 views:

Child View -
Display all results
Content Selection - Common
Query Filter: Select posts that are children of the Post where this View is shown.

Loop Output Editor:

[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->

<wpv-loop>
[wpv-post-link id="$consultant"]
</wpv-loop>

<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]No items found[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]

Filter and Loop Output Integration Editor:

[wpv-filter-meta-html]
[wpv-layout-meta-html]

2nd View Location-Parent:
Display the results using a custom search
Content Selection - Consultants
Custom Search Settings : AJAX results update when visitors change any filter values

Filter Editor:
[wpv-filter-start hide="false"]
[wpv-filter-controls]
<div class="form-group">
<label>[wpml-string context="wpv-views"]Country[/wpml-string]</label>
[wpv-control-postmeta field="wpcf-country" url_param="wpv-wpcf-country" type="select"

auto_fill="wpcf-country"]
</div>
[/wpv-filter-controls]
[wpv-filter-end]

Loop Output Editor : Here's I am using the child view

[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<wpv-loop>
[wpv-view name="child"]
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]No items found[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]

Filter and Loop Output Integration Editor
[wpv-filter-meta-html]
[wpv-layout-meta-html]

I got the filter to display but its not working because it shows all the consultants regardless the
country you select. In this particular example :
hidden link

This college has 2 consultants each from UK & USA. Its display both the results regardless the selection. I would like to display only UK consultants when selected UK & USA Consultants only when selecting USA and no items when selecting India.

#556462

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hello Ram,

I need to take a look at your setup and to request temporary website WP-admin and FTP info for your site to debug further and to help in resolving this. Your next answer will be private which means only you and I have access to it.

=== Please backup your database and website ===

✙ I would additionally need your permission to de-activate and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important.

✙ Please add the Links to the [View] Edit Screen.

Thank you

#556479

You have my permission to do anything inside the site.

Here's the link for the view edit link:

[credentials-removed]

Reference Site : hidden link

hidden link

#556549

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hello Ram,

I have tried few things in your site. Can you please confirm and explain why you are using many-to-many relationship for this?

As I see in real world the example and hierarchy is like this:

Country
  >> has Colleges
    >> has Consultants

-- In this case a Consultant can only belongs to one College, where as college is already linked to a Country. As such we don't need Country custom field for the Consultant itself.

Is the above scenario not same as your case? If your case is different please explain your hierarchy as well. Thanks

#556711

Hi

In my case : One consultant can have more than one colleges they belong to and One College can have more than one consultants

>> Colleges -- Country - Custom Fields
>> Common

>> Consultants -- Country - Custom Fields
>> Common

#557187

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hello Ram,

Sorry we ran into the weekend. Thank you for providing more details. I am again checking this now, looks like we have found some limitation or bug for many-to-many relationship Custom search. I will update you shortly with my findings.

Thank you for your co-operation.

#557328

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

I am able to reproduce this issue. I have escalated this issue to our 2nd tier support for further review and we will get back to you with an update.

Thank you for your co-operation and patience.

#557848

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Our 2nd tier support informed that this type of Custom Field search filter is not possible with Toolset for many-to-many relational posts. I have now submitted this as a feature request to our team for further consideration.

Thank you for cooperation. Have a wonderful day.

#558833

Thanks very much Noman.

#558872

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Please kindly mark this current ticket as resolved if all is good now.

You can subscribe to our blog for news and feature updates: https://toolset.com/blog

Thank you

The forum ‘Types Community Support’ is closed to new topics and replies.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.