Skip Navigation

[Resolved] Show related fields in many to many relation

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

Problem:
The customer was using a many-to-many relationship and wanted to show related posts, filtered by one of the custom fields from the intermediary post.

Solution:
Guided how to add a custom field query filter to the view's setting.

Relevant Documentation:
n/a

This support ticket is created 2 years, 3 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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/Karachi (GMT+05:00)

This topic contains 4 replies, has 2 voices.

Last updated by manuelL-5 2 years, 3 months ago.

Assisted by: Waqar.

Author
Posts
#2425681

Tell us what you are trying to do?
I have a "Solicitud" entry post and I want to show the Associated "Productores".
I show them but I cannot filter by a field of the intermediate post many to many (Solicitudes X Productores)
In this case I want to filter by the view where the status is equal to requested and another view where the status is quoted.
Or create a conditional field and filter the same. But the conditional has fewer options.

Is there any documentation that you are following?
Look in the link
hidden link

Is there a similar example that we can see?

What is the link to your site?
hidden link

#2426025

Hi,

Thank you for contacting us and I'd be happy to assist.

The view "Productores Elegidos en Solicitud" that is showing the related posts in the content template "Cliente Cotización Solo productores asociados" is set to show the intermediary post "Solicitudes Productores entradas intermediaries".

To filter the result based on the field "Estado" attached to this intermediary post type, you can include a query filter in the view's "Content Selection" settings.

For example, suppose you want to show only the related posts where the "Estado" field is set to option "Cotizado" with the custom field value of '2'.
( screenshot: hidden link )

In that case, you'll add a query filter for the Estado field where it is a number equal to a constant '2'.
( screenshot: hidden link )

Similarly, for filtering by the other option of the "Estado" field, you can just change the constant value to that option's numerical value.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#2426869

Thank you very much.
But now the basic filter doesn't work:
Because example in this post works fine
hidden link
But in this one he shows none and has an Associate Producer
hidden link

Tks.

#2427003

Thanks for writing back.

The solicitudes post "131" is not showing the related "Juan Cruz Giliberti" productores post because their connecting intermediary post ( 'Solicitudes Productores: 2324 - 1968' ), doesn't have any value saved for the "Estado" custom field.

The view "Productores Elegidos en Solicitud" in the "Cliente Cotización Solo productores asociados" template is set to show the results ordered by this "Estado" custom field.
( screenshot: hidden link )

This why, if any intermediary post ( Solicitudes Productores entradas intermediaries ) will not have a value stored for the "Estado" custom field, it will be ignored by the view.

#2427309

My issue is resolved now. Thank you!

Thank you very much!
Toolset support is awesome.
I had never seen anything like it.
I congratulate you!