Support has been upgraded!
The Support Forum is closed. Not to worry! Providing the top quality support you expect and we're known for will continue! We're not ending support, just changing where you submit requests. This will provide you with the best experience possible.
Premium Support
Have you purchased an addon for Connections such as one of our premium templates or extensions with a valid license and you need help?
Please open a Support Ticket in your user account.
Free Support
Are you using the free Connections plugin? Don't worry, you are still very important to us! We are still providing you with the same high quality support that we're known for.
Please open a new support topic in the WordPress support forums for Connections.
Tagged: 0.8.5, category, category_in, search, widget
- This topic has 9 replies, 3 voices, and was last updated 9 years, 2 months ago by
Steven Zahm.
-
AuthorPosts
-
05/05/2014 at 10:52 pm #290392
Mitch
ParticipantI couldn’t find anything referencing this, maybe I just missed it, but I thought I’d ask.
How can I use the search widget and limit the records it searches to only those in a selected category.
To explain usage in more detail, for example on a page that is rendered via url/connectionshomepage/category/categoryname I would like to put two search boxes (via the widget) on that page; Top) would be to search ONLY within records with that category id, and Bottom) a search that would instead search the entire database.
(I guess I could just use a button/link to the homepage for the entire database for that second option, but the initial question on limiting search return still applies either way).
I understand the concept of ‘category_in’ but how could I apply that to a specific placement of the search widget?
Thanks.
05/07/2014 at 12:30 pm #290542Steven Zahm
Keymaster@ Mitch
Ok, the Widget Pack is do for a refresh… I want to add a couple more widgets and incorporate a few features requests. What I can, and should be faily simple, I think, is I can add an checkbox option that when enabled will limit the search to the current category. That way you could place the widget on the page twice, just like you want.
I’ve added this to my feature request issue tracker. I’ll reply back to this thread one way or another.
05/07/2014 at 12:47 pm #290546Mitch
ParticipantThanks for the consideration. For anyone thinking about it, Widget Pack is a great value.
While you’re in Widget Pack, what would be really nice would be making the ‘categories’ widget be able to select/deselect specifically which categories to display for each instance and whether or not to show the (#) of listings in each category?
Just some thoughts.
Thanks
05/07/2014 at 9:02 pm #290582Christopher Mohler
ParticipantSorry to maybe hijack, but this is related to something I’ve been working on: a search widget with a drop-down that limits address results based on the ‘line_3’ address field (without touching core files or cMap).
(Client is using this field as a sort of “meta region” for lack of a better term)
I should pause here and pass out some kudos: Connections is a pretty hefty amount of code, and yet it’s very well organized. As someone who’s been hacking on stuff for years — and particularly WP stuff lately — I am very impressed. I was able to bang out a separate, helper plug-in all in one session today – thanks!
Anyway, I did grab the widget pack, thinking the search widget would be a good start but that was sort of a dead-end. What I need in sort-of-pseudo-code:
SELECT [card_addresses] WHERE [most_fields] LIKE [search_terms] AND [address_line_3] == [drop_down]. It’s the ‘AND’ that’s giving me fits.(and I think we could live with ‘SELECT [card] WHERE…’)
If you could point me to the correct hook/filter/action/file/etc I would be very grateful. Even pseudo code at this point would help me – been at it for days and I can’t figure out a way to accomplish this without hacking directly on Connections or the template.
Thanks.
-
This reply was modified 9 years, 4 months ago by
Christopher Mohler.
05/08/2014 at 12:04 pm #290655Steven Zahm
Keymaster@ Mitch
Yes, both those options are on the list for the category widget.
05/08/2014 at 12:18 pm #290668Steven Zahm
Keymaster@ Christopher
Honestly, I can not think of a way to do this without editing the core Connections code… maybe.
That custom query is the killer…
A solution might be to register a custom shortcode. Grab your query vars, do your custom query, but only select the
id
column. make sure the results is an indexed array.Then you could call the method that drives the Connections shortcode:
$atts = array( id => $custom_query_results ); return cnShortcode::view( $atts );
Or, maybe even easier…
Hook into the
cn_list_atts
filter, do your custom query like I mentioned and set$atts['id']
to an array of ids from the query results and pass back the moadified$atts
variable back from the filter.Will either of these work?
07/07/2014 at 3:04 pm #296218Mitch
ParticipantHey Steve,
Hope you had a great 4th.
It’s been a couple months since I inquired, so I thought I’d touch base on this and see if there was any roadmap for the widget pack ‘refresh’ and adding the features that we discussed in the thread.
Thanks and have a great week.
07/07/2014 at 4:36 pm #296247Steven Zahm
Keymaster@ Mitch
Greetings! The wife and I are redoing the dining room so we spent the time working on it. It’s fun :)
Hope your 4th was great too.
I have spent time on this. The underlying code for working with categories has been completely rewritten to be far more flexible. The problem with it is it is far more db intensive. So I’m looking into building in a results cache. After that’s complete, then it is simply updating the category widget with the couple new options.
07/07/2014 at 9:11 pm #296289Mitch
ParticipantExcellent. Always nice to get a fresh look on a room.
WRT code, yeah, would hate to see something become *more* db intensive, so anything you can do to include the features without killing the experience is great.
Any feel on the timeline? (nothing written in blood, just curious). :)
Thanks.
07/08/2014 at 4:05 pm #296458Steven Zahm
Keymaster@ Mitch
Honestly, I do not really have an ETA yet. The rewrite is more that just making it flexible. I want to be able to support custom taxonomies. Longer term goal, but I want to make sure the underlying code is ready.
-
This reply was modified 9 years, 4 months ago by
-
AuthorPosts
You cannot reply to this support topic. Please open your own support topic.