Skip Navigation

[Resolved] filter results

This support ticket is created 5 years, 9 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Tagged: 

This topic contains 19 replies, has 3 voices.

Last updated by martinP-13 5 years, 8 months ago.

Assisted by: Beda.

Author
Posts
#1206875

i been thinking a lot about this , and my solution is to make a search page where people can search for anything they like then filter down. would this sound easier? i would want to filter everything

#1208511

OK, I finally have time here.

I see no View or Filter on hidden link
I see the backend has no View inserted or CT assigned or Layout assigned which could hold a View either.
I assume you blanked this page so to let me insert what I think is best?

I am not sure, and the site looks like a live site, so I did not yet go and make edits.
To create a Search on that page, it depends a lot on what you want to search by.

If you want to find Dogs on that page, it's the wrong place I think, as it is already a Dog page.
So probably a search for dogs should go to a native WordPress Page.
For this, you can create a View, query dogs, and add filters.

But I also understood in past, you want to filter thru judges and events of a dog.
Here it is likely correct to put such a search ON the DOG page as you intended.

Now, let's say you want to search thru all events of a certain DOG, you can create a view, let's take a clone of hidden link: hidden link and query Events.
Choose a filter that says "Select posts in a Events Dogs relationship that are related to the Post where this View is shown."
Complete the Loop with some data of Events or any of their related posts
This will now, if inserted to a DOG post, show all events connected to that DOG.

If you now need to filter the events fields, you add more filters related to the fields of events, but since there are no fields in Events Post Type, there is nothing to filter yet either.
Similarly, you proceed for judges.
You can even query Judges AND Events in the same view, but if you filter there by fields of Judges, let's say, then obviously no events would be shown anymore.

Please let me know (use the clone I created) what you would like to query by, in a DOG post, related to Events and Judges.

1. to filter just the events that it had 1st place 2nd etc etc
We need to know where 1st and 2nd place is defined
I see no such fields in Events. Are those stored elsewhere?
2. just show result of certain stakes
The stake is a related post to events so you could add a Post Relationship Front end Filter for that, for example.
But, problematic here is you can only filter by one parent tree a time, and we already said "Select posts in a Events Dogs relationship that are related to the Post where this View is shown." for this view.
So that is not possible (you would have to submit a feature request https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/ to ask for this feature)
What we instead could do is add a custom code, that allows querying by the second parent tree.
This is possible, there is an example here:
hidden link
3. just results from an event with a certain judge
The same is valid here, since there is only one parent tree you can add, you cannot add judges as filter in the front end either.

There is either the custom code solution, or, you can use nested Views.
The Clone I created lists Events related to that DOG.
Then, create a View hat lists Judges related to the Post in the loop. Insert this view to the Clone View I created
Later, insert as well a View into the Clone View, which queries Stakes by the current post in the loop.

With this however you get a list of Posts (Events) belonging to a DOG (hence, many events) and for each event you get a list of the Juges and Stakes that belong to each such event.
Would that be a solution for you?

#1208535

thanks beda ill have a good read of that tonight and see whats what..... its getting awfully complex,on the fizzy page i notice that all judges are now listed and not just the ones related to the events, i'm not sure how that ha happening , its been very difficult to get to this stage ill have a good think over the weekend,enjoy yours and thx for getting back to me!!

#1208833
Bildschirmfoto 2019-03-02 um 15.43.28.png

Yes, such setups are complex.

I am helping another user here (he's building a site of handball games, players and teams)
Imagine the implication of "cups won", "join date of players", "rejoined dates of players", "successes of players while in team and successes of teams while a player was in team".
It's eating up all my personal RAM (LOL)

What is very helpful sometimes, is starting a "doodle" (not sure how you call a hand-drawing where things are outlined)
Drawing out the precise relations that one wants between the single items, and especially, how one wants to list and search them later, can and does help to recognize potential bottlenecks and avoid them before going too deep.
What I also noticed, with the other user, is that he set up the examples only once (so, did not create a lot of content yet but just focuses on structure)
This is also helpful, to narrow down the elements you play with.

Please also let me know what you mean with "the fizzy page I notice that all judges are now listed"
Is that as in the screenshot visible (A Panel Judge) section?
There, you would want only judges that belong to that one dog, I assume.
But, as said, I do not see where the content is inserted! I see the view used (it's 11584, 11627 View id, etc)
Are you using PHP to display the Views?
Can I ask why? It would be easier to use a Content Template, I think.

However, I see in the views that you use filters like
Select posts in a Events Judges relationship that are related to the Post with ID set by the shortcode attribute wpvrelatedto.
eg. [wpv-view name="view-name" wpvrelatedto="123"]
or
Select posts in a Stakes Events relationship that are related to the Post with ID set by the shortcode attribute wpvrelatedto.
eg. [wpv-view name="view-name" wpvrelatedto="123"]
So that means, there where that View is inserted to (whether this is PHP or content template) you must pass the ShortCode attribute values for wpvrelatedto
Maybe those are missing, that is why you see all the judges instead of only related ones?

Note, please consider my profile for my working time and hours, so you can plan your reply here (I will not be able to interact Sundays and Mondays, for example)
https://toolset.com/forums/users/beda-s/

Please also do not think you cannot achieve this, maybe there will be some adjustments to and hurdles to take, but we will get there, together 🙂

What I often do is start very small (less content and structure than I need or want) and add on top.
Often, (and I use Toolset since now several years) I ditch everything and start fresh because I simply recognize, what I want is not possible logically or structurally. That is frustrating but it teaches me how to proceed next time.
Things that are complex and work (like, I created a sidebar scrollspy once with Views only) I save into modules (Toolset Modules) so I never have to bother again to create the (fairly complex) structure.

#1219737

thanks beda , i have given up on this its far to complicated for my level of knowledge!!