Skip to content

Commit

Permalink
Fix ordering by attribute and related attributes
Browse files Browse the repository at this point in the history
This fixes sorting by attributes
which data type do not use value_sortable field.

This includes attribute of type currency, file size,
floor plan, geocode, integer, length, time code, weight,
and also date range in older versions of Providence.
  • Loading branch information
jiru committed Jul 10, 2023
1 parent b2345bf commit c518122
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/lib/BaseFindEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ private function _sortByAttribute($t_table, string $hit_table, ?string $element_
FROM ca_attribute_values cav FORCE INDEX(i_sorting)
INNER JOIN {$attr_tmp_table} AS attr_tmp ON attr_tmp.attribute_id = cav.attribute_id
WHERE cav.element_id = ?
ORDER BY cav.value_sortable {$direction}
ORDER BY cav.{$attr_val_sort_field} {$direction}
{$limit_sql}";

$qr_sort = $this->db->query($sql, [$element_id]);
Expand Down Expand Up @@ -873,7 +873,7 @@ private function _sortByRelatedAttribute($t_table, $t_rel_table, string $hit_tab
INNER JOIN {$hit_table} AS ht ON ht.row_id = t.{$table_pk}
{$filter_join}
WHERE cav.element_id = ? {$filter_where}
ORDER BY cav.value_sortable {$direction}
ORDER BY cav.{$attr_val_sort_field} {$direction}
{$limit_sql}";
$qr_sort = $this->db->query($sql, [$element_id]);
$sort_keys = [];
Expand Down

0 comments on commit c518122

Please sign in to comment.