Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Search results page sorting problem
This topic contains 16 replies, has 2 voices, and was last updated by Ernest Marcinko 2 years, 8 months ago.
- AuthorPosts
- September 26, 2020 at 9:06 am #29552
Hello,
I have set the search results page will redirect to Woocommerce Results Page.
The results page default sort is based in Relevance.
In the results page when I want to change the sort criteria (for example to Name or Date), the page displays “No products were found matching your selection”Can you please advise any fix?
Kind regards,
MajidSeptember 28, 2020 at 2:51 pm #29561Hi Majid,
Can I take a look at this issue somewhere? Also, can you please add temporary back-end and FTP details, in case I need to debug anything. Thank you!
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 1, 2020 at 4:19 am #29588You cannot access this content.October 1, 2020 at 9:49 am #29590Hi Majid,
The issue seems to be with the URL encoding – when I click on the switch button, it removes encoded URI components, such as empty whitespaces like ” ” or other characters as well.
You can try this even with the native search, for example searching “far mu”, results in this URL (replace yoursite.com with your site domain): https://www.yoursite.com/?post_type=product&s=far%20mu
When clicking on the sorting, it removes the “%20” whitespace character and changes the phrase to “farmu” which is incorrect: https://i.imgur.com/O3vh4R6.png
See after: https://i.imgur.com/y1hkKZz.pngUnfortunately that section is unrelated to the plugin, so it needs to be corrected elswhere.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 1, 2020 at 10:49 am #29591Hi,
Thanks for the reply.
I changed the Action for “Show ‘More results..’ text in the bottom of the search box” option.
Please try now using your own example search words and comment.Kind regards,
MajidOctober 1, 2020 at 11:22 am #29592I changed the Action for “Show ‘More results..’ text in the bottom of the search box” option. Please try now using your own example search words and comment.
Can you please explain? Is there an issue I should look for? I cannot tell only by looking at the site front-end, I don’t know what your configuration is.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 1, 2020 at 11:24 am #29593The same issue exists while the url is different and the “%20” whitespace character is not removed now!
Please have a look at the urls while searching “far mu” and try to change the sort.October 1, 2020 at 12:03 pm #29594That is what I am saying, please take a look: https://www.youtube.com/watch?v=tco5uyRKJOQ
Best,
Changing the sorting removes the special characters from the URI, which is not supposed to happen, and that is causing the problem. It is not the plugin creating the issue, as it does not print the sorting drop-down, it is probably a theme/page builder feature.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 1, 2020 at 12:05 pm #29595Ernest, Please ready my previous post once again!
I did write that in the new test, the “%20” whitespace character is NOT removed but the results page again displays nothing!October 1, 2020 at 12:16 pm #29596I understand that, but other encoded components are still removed. For example:
Best,
Original end of URI before sorting: https://i.imgur.com/MUNLeMK.png
After sorting, missing HTML encoded components as well as other arguments: https://i.imgur.com/fEgnkjn.png
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 1, 2020 at 12:22 pm #29597I see.
Are you aware of any possible incompatibility with other plugins?Regards,
MajidOctober 1, 2020 at 12:24 pm #29598By the way, I am using the following snippet based on your older solution to be able to search for some special characters:
add_filter(‘asp_indexing_string_pre_process’, ‘custom_chars_asp_indexing_string_pre_process’, 10, 1);
add_filter(‘asp_search_phrase_before_cleaning’, ‘custom_chars_asp_indexing_string_pre_process’, 10, 1);
add_filter(‘asp_query_args’, ‘custom_chars_asp_indexing_string_pre_process’, 10, 1);
function custom_chars_asp_indexing_string_pre_process($s) {
$original = array(
‘Ā’, ‘ā’, ‘Ā’, ‘ā’, ‘Ḥ’, ‘ḥ’, ‘Ḥ’, ‘ḥ’, ‘Ī’, ‘ī’, ‘Ī’, ‘ī’, ‘Ṣ’, ‘ṣ’, ‘Ṣ’, ‘ṣ’, ‘S̲’, ‘s̲’, ‘Ṭ’, ‘ṭ’, ‘Ṭ’, ‘ṭ’, ‘Ū’, ‘ū’, ‘Ū’, ‘ū’, ‘Z̤’, ‘z̤’, ‘Ẓ’, ‘ẓ’, ‘Ẓ’, ‘ẓ’, ‘Z̲’, ‘z̲’, ‘Ẕ’, ‘ẕ’, ‘ʼ’, ‘ʻ’, ‘ʹ’
);
$replace = array(
‘a’, ‘a’, ‘a’, ‘a’, ‘h’, ‘h’, ‘h’, ‘h’, ‘i’, ‘i’, ‘i’, ‘i’, ‘s’, ‘s’, ‘s’, ‘s’, ‘s’, ‘s’, ‘t’, ‘t’, ‘t’, ‘t’, ‘u’, ‘u’, ‘u’, ‘u’, ‘z’, ‘z’, ‘z’, ‘z’, ‘z’, ‘z’, ‘z’, ‘z’, ‘z’, ‘z’, ”, ”, ”
);// Replace them
if ( is_array($s) ) {
if ( isset($s[‘s’]) && !$s[‘_ajax_search’] )
$s[‘s’] = str_replace($original, $replace, $s[‘s’]);
} else {
$s = str_replace($original, $replace, $s);
}return $s;
}October 1, 2020 at 12:33 pm #29603We are not aware of any issues with other plugins at the moment. I just tested this exact feature with WooCommerce core and it works all right. That custom code unfortunately has no effect on this. You can try removing it briefly, but it should not change anything.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 1, 2020 at 1:33 pm #29605Wouldn’t you like to have closer look to find the issue?
October 1, 2020 at 2:00 pm #29606Unfortunately I cannot tell what is exactly causing this. It looks like probably the theme. Try switching the theme to the default one (twenty twenty perhaps) to see if the issue continues.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.