Skip Navigation

[Closed] Many to Many – Again

This support ticket is created 4 years, 6 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 18 replies, has 2 voices.

Last updated by Nigel 4 years, 6 months ago.

Assisted by: Nigel.

Author
Posts
#1614739
content.png
filter.png

Tell us what you are trying to do? Display a relationship

Is there any documentation that you are following? https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/

Is there a similar example that we can see? No

What is the link to your site?

I hate to say it, but your documentation is very, very lacking. This is a 3 minute procedure in Drupal.

I have instruments and music styles. I have a M:M relationship between them.

I need to show which instruments (pages) are related to that style.

The relationship between instruments and music styles doesn't show.

I know it's my error, but your documentation is very, very bad.

#1615197

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

I assume you are editing the template for music styles, and you want to display instruments related to the current music style.

So, while editing your template, you insert a View block, choose instruments for the content selection, and then (with the View block itself selected, rather than one of the inner blocks) in the sidebar add a Query Filter, to show related posts from this relationship related to the page where this View is shown.

(I don't think the preview updates in the backend with the related posts, but check the front end and you should see the correct posts.)

Regarding the documentation, the current development cycle is actually focused on making displaying related posts much more intuitive (and the documentation redundant).

#1618501
Screen Shot 2020-05-09 at 5.59.55 PM.png
Screen Shot 2020-05-09 at 5.59.41 PM.png
Screen Shot 2020-05-09 at 5.58.56 PM.png
Screen Shot 2020-05-09 at 5.58.29 PM.png

Something is missing. It really, really shouldn't be this hard.

There is no way to select any fields from instruments

#1618539

I also want to make it clearer. I also want to display a link to the Instrument(s) so they can click on the instrument and go to it's page.

#1619367

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

I'm not sure what the problem is, I just checked on my local test site and it is working as expected, the fields of the related posts are available (whether I'm using the Single Field block or the Fields and Text block which it looks like you are using).

Could I get access to your site to see if I can spot the problem?

Let me mark your next reply as private so that I can get log-in credentials from you—you may want to create a temporary admin user for me to use that you can later delete. And be sure to have a current backup of your site.

The View is inserted in the template for music styles, is that right?

#1621651

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Screenshot 2020-05-12 at 15.50.17.png

I can see that some of the fields for instruments are available, but not all (screenshot).

There also appears to be a problem with the View not updating when the post preview selection is changed.

It will be easier for me to try and debug this locally, so I've taken a copy of your site and I'll report back when I have it up and running here and can determine what the issue is.

Thanks for your patience.

#1621661

Thanks. At least I'm not going crazy!

#1622735

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

I need to escalate this so that second tier can take a deeper look.

It's not just that some of the custom fields are missing when trying to display related posts in a View, if you make a template for Instruments themselves and try to output the fields using a Single Field block you have the same problem, they are just not available as dynamic sources.

I've stripped back your site to the bare essentials needed to demonstrate the problem and passed on that version of your site.

I'll keep you posted.

#1623653

Thanks, and it's not a huge hurry.

#1624151

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

I'm feeling a little sheep-ish, but, then, maybe not because it's not exactly intuitive.

Your field group contains four fields. Two of these accept only single values, two of them accept multiple values.

When you use the Single Field block to insert a field, you can only use it to insert fields that accept single values. Hence in my screenshot it showed only "More information" and "Music notation" fields offered.

To insert the Byline and Audio Example fields (which can accept multiple values) you need to use the Repeating Field block to add those fields.

(I'm proposing changes to this to the dev's right now.)

By the way, you can use the Fields and Text block which has the Fields and Views button you may be familiar with from the classic editor which you could use to insert any field, without having to first think whether they accepted multiple values or not.

Can you try again mixing the Single Field and Repeating Field blocks as required (or using the Fields and Text block)?

#1625029
Screen Shot 2020-05-14 at 7.07.20 PM.png

I wish I could, but this is so counter-intuitive it's really bad. As I said, in Drupal this is a 2 minute query. In SQL it's a 30 second to write query. This REALLY needs to change.

I can't select instruments.

#1625193

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

That screenshot shows you trying to select custom fields, not instruments.

You already chose instruments for the post type returned by the View didn't you?

And added a Query Filter to limit the results to instruments related to the current music style?

So this View has queried and returned related instrument posts, and will iterate over the results in the output section.

If you want to output the name of an instrument, well, that is the title of the post, and you can use the Single Field block to output that standard field (or maybe use a heading block to output it using dynamic source).

If you want to output the custom fields from the instrument then that's where you are at with your screenshot. Using the Single Field block to output a custom field. Your instrument post type has the Music Styles Fields field group assigned to it, so that's what is being presented to you in the dropdown.

#1625219

Instruments doesn't even show up. And no, it returns music styles post title. Remember, it's a music style, that needs to display instruments, not music styles. Even you are getting confused.

As I said, way, way, way to confusing and complicated. I'll mess with it more tomorrow.

#1625221
Screen Shot 2020-05-15 at 12.04.54 AM.png
Screen Shot 2020-05-15 at 12.03.17 AM.png
Screen Shot 2020-05-15 at 12.03.07 AM.png

Here. It is a music styles post type. I need to have a view that displays all the instruments.

#1625305

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Screenshot 2020-05-15 at 08.44.48.png

I'm not having any problems doing this on my local copy of your site.

In the screenshot I'm editing the content tempate for music styles, it's using Punto Guajiro to preview, it has found a related instrument that I'm outputting the post title of (Cuban Laud).

I'm outputting a single field with the Single Field block (Cuban Laud Tuning), and a repeating field with the Repeating Field block (byline = John Griffin).

Obviously the output is crude, this just demonstrates it is working.

Do you want me to try the same on the site on your server?

The topic ‘[Closed] Many to Many – Again’ is closed to new replies.