Skip Navigation

[Resolved] Populating a drop-down menu from the child of a many-to-many relationship

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

Problem:

In the relationship filter field, we only want to see the related posts CONNECTED to those items.

Solution:

Please try these:

Edit the post view you mentioned above, in section "Custom Search Settings", enable option " Let me choose individual settings manually"-> Enable option "Show only available options for each input", and test again.

Relevant Documentation:

https://toolset.com/documentation/user-guides/views/front-page-filters/advanced-settings-custom-search/

This support ticket is created 4 years, 11 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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 2 replies, has 2 voices.

Last updated by peterv-5 4 years, 11 months ago.

Assisted by: Luo Yang.

Author
Posts
#1546079
For-ToolSet.jpg

I have 4 "Many to many" relationships, all connecting to my custom AHHA-Author post type:

many AHHA-Authors <---connected to---> many Self-Help-Videos
many AHHA-Authors <---connected to---> many Self-Help-Articles
many AHHA-Authors <---connected to---> many Self-Help-Tools
many AHHA-Authors <---connected to---> many Spiritual-Books

I'm creating a search page to search through the "Self-Help-Articles" post-type.
I want to search by Last Name of the "AHHA-Author" post-type, that is connected to the "Self-Help-Article".

I used the "New Filter" button to add this code to the search/view:

[wpv-control-post-relationship ancestors="ahha-author@ahha-author-self-help-article.parent" url_param="wpv-relationship-filter"]
<div class="form-group">
<label for="wpv-relationship-filter">[wpml-string context="wpv-views"]Search specific authors[/wpml-string]</label>
[wpv-control-post-ancestor type="select" ancestor_type="ahha-author@ahha-author-self-help-article.parent"]
</div>
[/wpv-control-post-relationship]

But instead of getting JUST "AHHA-Authors" of "Self-Help-Articles", I see in the list ALL "AHHA-Authors" of all 4 of the connected custom post types.

You can see it happening here:

hidden link

If you select: "AlHajri, Faris, Ph.D. (A.M.)" and click Search, you'll get no results returned. This is correct because "AlHajri, Faris, Ph.D. (A.M.)" is not the author of a "Self-Help-Article", he is only the AHHA-Author or a "Self-Help-Video".

The SEARCH RESULTS work.
BUT, we don't want to see "Abdo, John, CFT" showing up in this drop down - because we only want to search by "AHHA-Authors" OF "Self-Help-Article".

Otherwise, selecting one of the AHHA-Authors, like "AlHajri, Faris, Ph.D. (A.M.)", will return NO RESULTS.

***
And of course, I'll want to do the same on the pages for the other searches of: Self-Help-Videos, Self-Help-Tools, and Spiritual-Books; We only want to see the AHHA-Authors CONNECTED to those items, not ALL AHHA-Authors of everything.

#1546553

Hello,

Please try these:
Edit the post view you mentioned above, in section "Custom Search Settings", enable option " Let me choose individual settings manually"-> Enable option "Show only available options for each input", and test again.

More help:
https://toolset.com/documentation/user-guides/views/front-page-filters/advanced-settings-custom-search/
See screenshot:
hidden link

#1547481

My issue is resolved now. You Rock!