Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
Svein Magne Skåre

Problems with search and filtering when using sorting

Hello Team,

First of all. Thanks for a very useful plugin :)

I have one issue that confuses my customers. When I using AdminColumn Pro sorting function to sort a field, under products (woocommerce) for example, the search-function will not function properly. If I sort on a column (Menu Order ascending) and search for “Ski” the search returns 1 product. When I pushes the reset sorting button, the search returns 5 products. Why this behaviour?

Please advise :)

Best
Svein Magne

1 month ago
Stefan
Developer

Thanks for your feedback.
I’m not able to reproduce the issue that you’re describing.
Sorting on the Menu Order should not affect the number of posts that are found by the search feature.
Maybe another plugin or something in the theme might cause a conflict on the Query performed by WooCommerce.

You could install the Query Monitor plugin, and have a look at the difference between the query with sorting enabled and disabled. If you like, you can send me the main queries ( support@admincolumns.com ) so I can compare them with my local environment.

1 month ago
Svein Magne Skåre

Thanks for your reply Stefan,

I think I have spotted why the results is difference when sorting some fields.

For example under Users.

When i sort Company Name (billing_company) some of the companies do not have a Company Name. It seems that when i sort company name and search in the search-field for users only rows with company name filled will be available to search in? Can that make sense? Only 2 of all 7 administrators have company billing set.

Filering for role “Administrator” when sorting is set to sort company billing.
Returns 2 rows.

SELECT SQL_CALC_FOUND_ROWS wp_29ca8b97d3_users.ID
FROM wp_29ca8b97d3_users
INNER JOIN wp_29ca8b97d3_usermeta
ON ( wp_29ca8b97d3_users.ID = wp_29ca8b97d3_usermeta.user_id )
INNER JOIN wp_29ca8b97d3_usermeta AS acsort_usermeta
ON wp_29ca8b97d3_users.ID = acsort_usermeta.user_id
AND acsort_usermeta.meta_key = ‘billing_company’
AND acsort_usermeta.meta_value <> ”
WHERE 1=1
AND ( ( ( wp_29ca8b97d3_usermeta.meta_key = ‘wp_29ca8b97d3_capabilities’
AND wp_29ca8b97d3_usermeta.meta_value LIKE ‘%\”administrator\”%’ ) ) )
ORDER BY CAST( acsort_usermeta.meta_value AS CHAR ) ASC, wp_29ca8b97d3_users.ID ASC
LIMIT 0, 25

Filtering when sorting is not set.
Return 7 rows

SELECT SQL_CALC_FOUND_ROWS wp_29ca8b97d3_users.ID
FROM wp_29ca8b97d3_users
INNER JOIN wp_29ca8b97d3_usermeta
ON ( wp_29ca8b97d3_users.ID = wp_29ca8b97d3_usermeta.user_id )
WHERE 1=1
AND ( ( ( wp_29ca8b97d3_usermeta.meta_key = ‘wp_29ca8b97d3_capabilities’
AND wp_29ca8b97d3_usermeta.meta_value LIKE ‘%\”administrator\”%’ ) ) )
ORDER BY user_registered DESC
LIMIT 0, 25

Any change of changing this, so when sorting by billing company, all administrators shows, with admins without billing company shows in order below companies with filled in company name?

Hope this make sense and you understand my questions :)

Best
Svein Magne

1 month ago
Stefan
Developer

Svein,

That makes sense and the way sorting works is actually intended. When you sort on a column, records without a value are filtered out at the moment. But this can easily be changed on our settings page. You can also have a look at our documentation on how to show all results when sorting. It is good to know that on large datasets, it might be noticeably slower when you enable that feature.

https://docs.admincolumns.com/article/86-show-all-results-when-sorting

4 weeks, 1 day ago

You must be logged in to reply to this topic.