-
Notifications
You must be signed in to change notification settings - Fork 314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/facets order #2288
Fix/facets order #2288
Conversation
@@ -332,7 +334,7 @@ private function order_by_selected( $terms, $selected_terms ) { | |||
ksort( $selected_terms ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oscarssanchez Maybe I'm missing something but it doesn't make sense to keep these ksort
functions since we'll order the items late with uasort
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oscarssanchez When I'm trying to order by term name, the children terms are inverted.
For example setting this way Order Terms By: Term Name and Term Order: Descending, I have this:
- Cursus
- Consectetur
- xonsectetur children
- consectetur children
After selecting Consectetur (parent), the children appears that way:
- Consectetur
- consectetur children
- xonsectetur children
The same occurs when I select Term Order: Ascending.
However, it's working for Order Terms By: Count.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Rahmon i have updated this per our meeting to do the correct ordering.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
@Rahmon @oscarssanchez before we merge this one, a couple of questions:
|
Description of the Change
This PR fixes #2207
Currently, the problem seems to be https://github.com/10up/ElasticPress/blob/develop/includes/classes/Feature/Facets/Widget.php#L332 sorts alphabetically but doesn't have a logic to discern when ordering by count has been set. I'm adding two new optional parameters to the
order_by_selected
method so it accounts for this scenario.Alternate Designs
Benefits
Possible Drawbacks
Verification Process
Checklist:
Applicable Issues
Changelog Entry