Skip to content
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

Search Results Cannot Be Sorted #1432

Closed
bhsmither opened this issue Dec 29, 2016 · 2 comments
Closed

Search Results Cannot Be Sorted #1432

bhsmither opened this issue Dec 29, 2016 · 2 comments
Assignees
Labels
Milestone

Comments

@bhsmither
Copy link
Contributor

Line numbers are for CC611 RTM:

Line 1616 creates the $order_string variable from earlier code.

Line 1669 builds the $query for a fulltext search SQL statement. This $query includes $order_string.

Line 1672 builds $q2 for a count. This $q2 also includes $order_string but it isn't necessary. (The Database class can be enhanced to use SQL_CALC_FOUND_ROWS in the query() method.)

Line 1714 builds $query for a LIKE or RLIKE SQL statement. This $query does not include $order_string.

Suggest:

$query = $q2.' '.$order_string.' '.$limit;

Line 1734 is the section of code that searches for Sale Items. The queries here uses it's own $order_string but due to two other factors, this parameter gets lost. May have been fixed in another issue.

@briansandall
Copy link
Contributor

Fixing this issue brings to light once again #431 - neither 'Retail Price' nor 'Sale Price' from the admin settings page display the same sort order as the 'Price' selection in the dropdown, as they sort specifically by that single price column rather than the highest or lowest of the two.

A result of this is that it is impossible for the admin to set the default search order to be by price, and choosing any sorting option in the admin menu that does not exist in the dropdown results in the dropdown displaying an erroneous selection.

E.g. if the store setting is to sort by 'Sale Price DESC', the dropdown shows 'Name (Z-A)' as the sort order when the page first loads.

It seems to me that it would be best if the same options that appear in the admin setting also appear in the dropdown, but I would suggest that a separate 'search order' setting be created for this as many if not most of the options for displaying a category would be either irrelevant (e.g. category id) or not suitable (e.g. cost price) for a customer to sort by.

briansandall added a commit to briansandall/v6 that referenced this issue Dec 30, 2016
briansandall added a commit to briansandall/v6 that referenced this issue Jan 3, 2017
briansandall added a commit to briansandall/v6 that referenced this issue Jan 5, 2017
briansandall added a commit to briansandall/v6 that referenced this issue Jan 5, 2017
briansandall added a commit to briansandall/v6 that referenced this issue Jan 6, 2017
abrookbanks added a commit that referenced this issue Jan 12, 2017
@abrookbanks abrookbanks self-assigned this Jan 12, 2017
@abrookbanks abrookbanks added this to the 6.1.4 milestone Jan 12, 2017
@abrookbanks
Copy link
Member

Thanks for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants