Skip Navigation

[Resuelto] One to many relationship

This support ticket is created hace 3 años, 8 meses. 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

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)

Este tema contiene 20 respuestas, tiene 2 mensajes.

Última actualización por Minesh hace 3 años, 7 meses.

Asistido por: Minesh.

Autor
Mensajes
#2006121

Tell us what you are trying to do?
I'm trying to show the child of a parent (one to many), I want to show events (many) of a venue (one)

Is there any documentation that you are following?

Is there a similar example that we can see?

What is the link to your site?
enlace oculto

#2006201

Minesh
Supporter

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

You will require a view to display the many childs belongs to single parent.

Here is the Doc where you can find how you can display the many related posts.
=> https://toolset.com/course-lesson/displaying-related-posts/#displaying-many-related-items

#2006271

Hello, Thank you!

I already have it shown, but for example if I wanted to make a venue filter and show the venue events with the venue filter (search by venue name)

I hope you can help us.

Thank you in advance. We wait for your response.

Best regards,

#2006345

Minesh
Supporter

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

You can obviously add a parent field as a filter that will allow you to select the parent posts.

Please check the following doc and follow the steps:
=> https://toolset.com/course-lesson/creating-a-custom-search/#add-filters-based-on-post-relationships

#2011903

We need help, right now we have a page where there is an event filter. It should show all the venues of the events with filters match. Help us please.

#2011905

I can show all the venues of an event, but I need to show all the venues of the events that match with event filter

#2012979

Minesh
Supporter

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

Can you please share problem URL and admin access details so I can check whats going wrong with your setup.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) 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 have set the next reply to private which means only you and I have access to it.

#2013281

Hello,

I want to add a filter "DISTANCE MAPS" for the parent of products that is a florist and not how to show it for the products that are related to the parent.

Link:
enlace oculto

Best regards,

#2013303

Minesh
Supporter

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

The thing is that you can add a frontend filter for the fields/custom fields that are directly related to the post type you set your view to query.

So, if you have post type product and you set your view to query product post type, then you can not add frontend filter for the custom field that belongs to post type "florist".

Can you please clarify bit more with example and what is exactly your structure as in initial post you said that your want to display venues filter by events where events (many) of a venue (one).

#2013441

Hello,

ignore the above (events) is an example. I tell you exactly what I want to do, on this page enlace oculto I want to add a filter "DISTANCE MAPS", but the field is for the parent of products that will be a florist.

Best regards,

#2013451

Can you delete the message with details. It's not a private.

Please.

#2013455

Minesh
Supporter

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

I make the previous reply private but when I try to login I could not able to login.

I already explain you that you can not filter a view using the field that belongs to another post type.
=> https://toolset.com/forums/topic/one-to-many-relationship/#post-2013303

Again, For example, if you create a view using post type A, you can only add the custom field filters that belongs to post type A, you can not filter the view with another post type field B as you view is set to query post type A.

#2013469

Hello,

So what can we do? can we make the filter with the code? using toolset function?

Best regards,

#2013473

So what can we do? Can we make the filter with the code? using toolset function?

#2013477

Minesh
Supporter

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

I suggest you should create a dummy field within your child post type and copy the parent field value to your child field. After that you can add that dummy filed as a filter.

Another way is to use view's hook "wpv_filter_query" as per your requirement but it will require custom code and you need to adjust the custom code as per your need.
=> https://toolset.com/documentation/programmer-reference/views-filters/