Sauter la navigation

[Résolu] nested view

This support ticket is created Il y a 5 années et 10 mois. 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
- 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)

Marqué : ,

Ce sujet contient 15 réponses, a 3 voix.

Dernière mise à jour par AndreG3332 Il y a 5 années et 10 mois.

Assisté par: Nigel.

Auteur
Publications
#1199149
herman learner programme.png
herman results.png

I am trying to do a nested view but my results are not working.
I have a cpt called learner programme where a list of learner programmes are listed this is in a one to many relationship with a cpt called results.

Here the result of the outcome of the learner programme is captured. ie enrolled, not yet competent, competent.

I now want to create a view where all learner programmes are listed with the results of the outcome.

This was done by creating a nested view . The child view being results and parent being learner programms.

I am attaching screen print of both view, if you could have a look at them and see if you can see why the are giving me a no result report. Link to report: lien caché

#1199204

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

I think your Query Filter should be set to "The current post in the loop" rather than "The post where this View is shown".

Can you try that to see if it fixes the problem?

#1199862
herman learner nested view.png
herman learner programme.png
herman results.png

Hi NIgel , Thx that worked like a dream. However, I want to go one step further. I want to add one more level. and i am getting no results again. this time i want learner program to be a nested view of the learner view.

In other words a nested view in a nested vire in a view.

I am attaching again the screen print of al three the views . The first two is working as anticipated.

Just for clarity: results is a child of "learner program", "learner program" is a child of "learner".
The learner to learner program is not working.

#1199940

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

So, you insert the outermost View (for learners) onto a page, and you just see the surname and fullnames plus "no results found" (coming from the nested learner program View) for each iteration of the main learner loop?

You see data from the learner posts, but no learner program posts are found?

#1200330

Yes , that is correct

#1200360

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

The settings are the same as in the other nested View. It seems the most likely explanation is that the data is not connected, that you have learner posts and learner program posts, but they are not connected.

If you check and are sure that they certainly are, before going much further could you turn on debug mode for Views at Toolset > Settings > Front-end Content and then let me have the URL where the learner View is inserted, I might be able to spot something from that debug info when I look at the page on the front end.

#1200952

Hi Nigel, I hope I understand "connected as having a relationship between two posts. If that is your question then the answer is yes. they are related.

I have activated the debug option as requested. Here is the url for all three the views on one page

lien caché

#1201790

Hi Andre,

Thank you for waiting.

Nigel is on vacations and will be back tomorrow, but I'll be happy to assist while he is away.

From the screenshots, all 3 views seem to be configured correctly, but it seems that the view's debug mode has been disabled now.

It would be interesting to check if there are enough data items available in the participating CPTs, which are also connected with each other, to show on the frontend, through these nested views.

In case you've confirmed that related posts exist on the website, but they're still not showing, you're welcome to share temporary admin login details, in reply to this message for deeper troubleshooting.

I've set your next reply as private so that only you and our support team can access it.

Important note: Please make a complete backup copy of the website, before sharing the access details.

regards,
Waqar

#1202354

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

Screenshot 2019-02-19 at 12.42.42.png

I looked at your site and made a couple of minor edits to the Views so that I could see the titles of the posts being returned, but, as suspected, the reason no results are being returned by the nested View to display learner programs is that the data is not connected in the backend.

The outer View, which displays learners, shows two posts, "Roos Koos Chris" and "Stien Rien".

These should be connected to "learner program" posts, which is what the first nested View tries to display.

But if you edit Stien Rien, for example, you will see that there are no related learner programs (see screenshot).

#1204238

Hi NIgel,

I totally misunderstood what you meant with "connected" I thought it related to relationship connections. Now i do see the error of my ways.

That taken into account raises the next question. How do I show the connection fields in a cred form? My intention is to create a cred form for the Student updating with ajax. Then to add the three related field in that form. Very much like the approach used in the native WordPress "add new record" approach. I am not able to add the related fields in the default create a new form screen

#1204403

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

I'm not sure what the confusion is around the relationship connections.

Just to be sure, when you create a relationship between post types, the connections are not automatic. If you create a relationship between projects and tasks you still need to specify which tasks belong to which projects, by connecting the individual posts.

Sorry if I'm stating the obvious, but I'm not sure where the confusion arises.

Regarding connecting posts with forms, for one-to-many relationships this is more-or-less straightforward inasmuch as you can do so with normal post forms.

If you create a form to publish child posts (the many part of a one-to-many relationship) then you include a field in the form to choose the parent post.

With the newly-released drag-and-drop form builder such fields are no longer included by default, you need to drag them from the right to where you want them in the form on the left.

Then on the front end there will be a select dropdown to choose the parent.

(You can pre-select the parent as described here: https://toolset.com/documentation/post-relationships/selecting-parent-posts-using-forms-create-child-items/#creating-forms-when-a-parent-post-is-preselected)

#1204409

Hi NIgel,

Thx for this will look into it. It was not on your side. lets call it a blond moment from my side!

#1205386

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

Let me know how you get on.

#1206038

Hi NIgel,

I have figured out that my relationship type was incorrect. I need many to many relationships in this instance.
I have created the right relationship now for the Learner qualification.

This shifted the goal post a bit for me. I tried to set up a relationship form to do the many to many links but am still lost.
My target is to have a page with add new learner take-on form that will include the option to set the learner qualification option.

I have tried to create a relationship form learner qualification but I'm not able to get it working. The setting seems to have me confused a bit.

Les nouveaux fils créés par Nigel et associés à celui-ci sont repris ci-dessous :

https://toolset.com/fr/forums/topic/split-publishing-related-many-to-many-posts/

#1206127

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

I've just split this to a new thread, as we have gone from talking about displaying related posts to creating them with forms.

I think we can probably close this one.