heldercervantes Posted July 27, 2023 Share Posted July 27, 2023 Hey guys and gals. I have a page tree that I want to search, where the second level has an "archived" checkbox. Something like this: Home Products Category ('archived' checkbox field is here) Product (these also can have subpages that I want to catch too) Product Product And now that I'm making the search engine for this site, I want to query all product pages, and I want to sort them showing "non-archived" items first. I suppose there's a way I can incorporate something like 'sort=$page->parents[2]->archived' (not like this of course, but...) Any ideas? Link to comment Share on other sites More sharing options...
BrendonKoz Posted July 27, 2023 Share Posted July 27, 2023 I can't find any documentation at this moment that shows this working, and I don't have any sites that come to mind where I could test this, but I think it works... If your search is only searching pages that have a template of 'product' (or whatever your product template is), I believe you can use this: sort=-parent.archived This assumes that the value of archived is 1, if it is indeed archived. 3 Link to comment Share on other sites More sharing options...
Robin S Posted July 27, 2023 Share Posted July 27, 2023 You could use the Find Merge module and supply it with two selectors: one for products without an archived ancestor and one for products with an archived ancestor. You'd probably start by finding the archived categories, then your selectors would include "has_parent!=$archived" and "has_parent=$archived". 4 Link to comment Share on other sites More sharing options...
heldercervantes Posted July 28, 2023 Author Share Posted July 28, 2023 16 hours ago, Robin S said: You could use the Find Merge module and supply it with two selectors: one for products without an archived ancestor and one for products with an archived ancestor. You'd probably start by finding the archived categories, then your selectors would include "has_parent!=$archived" and "has_parent=$archived". Well, I can just do two searches. I'm just being stubborn assuming there's a straightforward solution for this ? Link to comment Share on other sites More sharing options...
Jan Romero Posted July 28, 2023 Share Posted July 28, 2023 (edited) (nvm) Edited July 28, 2023 by Jan Romero Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now