Skip Navigation

[Resolved] How to Group Search Results by Custom Field value

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 10 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

This topic contains 6 replies, has 2 voices.

Last updated by kitsG 10 years, 7 months ago.

Assisted by: Ghennadi.

Author
Posts
#143752

Hi! Is grouping of search results by custom field value possible? I have a country and region custom fields and i created a parametric search for this. The problem is i can't see group by in filter. I want to achieve an output something like this: Let say i put USA in my country in search then the output is

Result for USA

Alaska
- Custom post with country of USA and Alaska Region
- Custom post with country of USA and Alaska Region
- Custom post with country of USA and Alaska Region

Arkansas
- Custom post with country of USA and Arkansas Region
- Custom post with country of USA and Arkansas Region
- Custom post with country of USA and Arkansas Region

... and so on

Kindly give me an idea how to achieve this? Thanks

#144321

Dear kitsG,

You have to add 2 Views for this.

View 1. Will select all states related your search. Alaska, Arkansas etc.
in this view loop you have to add other view with attribute (example state) and value you get from loop (Alaska, ...)

View 2.
Get State from view 1 and search posts related this keyword.

structure:

View1:
start view1 loop
State title
[view2 shortocde state="state title"]
end view1 loop

View 2:
start view2 loop
post title related state title
end view2 loop

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.
Regards,
Gen.

#144629

Hi Ghennadi,

Thanks for your reply. Im still confused on how to implement it. I have a lot of countries (all countries in the world) and a lot of states/region depends on country selected, if im going to declare it in shortcode something like [view2 shortocde state="state title"] its a lot of work.. If you can provide me the actual code that would be great.

Thanks

#144783

Dear kitsG,

I just sent you private email, please check.

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.
Regards,
Gen.

#145072
parametric.png

Hi Ghennadi,

Really appreciate your support! I've implemented everything based from your test site but unfortunately i got unexpected result. I duplicates the group. Please refer to the attached image for your reference. I noticed that we are using different version of toolset. Is this has something to do with the version or i just coded it wrong? Thanks

#145201

Dear kitsG,

I’ll send you a private email right now asking you for some private information that will help me setup correct views for you. Please check your email in a couple of minutes, and if you don’t get it, let me know so I can send it again.

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.
Regards,
Gen.

#146472

Hi Gen,

Thanks for your support! I've already fixed it. 😀

The forum ‘Types Community Support’ is closed to new topics and replies.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.