Ultimate SEO Urls
Advanced search result bug - Ultimate SEO Urls
Advanced search result bug
Hi there,
Just found a bug when doing searches with two words, eg. red apples. The results are correct but when you click on it you get an error page : ERR_TOO_MANY_REDIRECTS. This does not happen in single search words like "apples". Any ideas, please?
Just found a bug when doing searches with two words, eg. red apples. The results are correct but when you click on it you get an error page : ERR_TOO_MANY_REDIRECTS. This does not happen in single search words like "apples". Any ideas, please?
-
- VIP Member
- Posts: 119
- Joined: Thu Oct 29, 2020 12:34 pm
- Contact:
Re: Advanced search result bug
I didn't test search - it seems that search is adding a keywords parameter. Seems that the addon doesn't like the '+' sign inside the query so I¡ll have to see where the error is happening. I'll come back when fixed.
-
- Posts: 96
- Joined: Thu Mar 11, 2021 2:16 am
- Contact:
Re: Advanced search result bug
I think this will fix the issue: changing usu_cleanse function in includes/apps/ultimate_seo_urls/includes/usu_general_functions.php to:
The reason was Phoenix search was generating urls with an space inside the search parameter (URL should not contain a literal space but a '+' character) and USU didn't understand it. With the above it will ensure the parameters do not contain any space and will allow characters like % [ ] { } that are often used by addons.
I'll later look at the rewrite part also to ensure spaces are passed correctly when generating URL.
Please let me know if it works for you.
Code: Select all
function usu_cleanse( $value ) {
// replace the spaces with + signs and remove spaces at the end
$value = htmlspecialchars_decode (rtrim($value));
$value = preg_replace( '/ /', '/+/', $value );
return preg_replace( '@[^a-z0-9_\%{}[]]@i', '', $value );
}
I'll later look at the rewrite part also to ensure spaces are passed correctly when generating URL.
Please let me know if it works for you.
-
- Posts: 96
- Joined: Thu Mar 11, 2021 2:16 am
- Contact:
Re: Advanced search result bug
Ok there must be something else in the code. I found some products doesn't add to cart when added from a search with spaces because the form is still keeping spaces inside. I'll keep testing.
-
- Posts: 96
- Joined: Thu Mar 11, 2021 2:16 am
- Contact:
Re: Advanced search result bug
Thanks for your efforts, I will wait for the fix.Piernas wrote:Ok there must be something else in the code. I found some products doesn't add to cart when added from a search with spaces because the form is still keeping spaces inside. I'll keep testing.
-
- VIP Member
- Posts: 119
- Joined: Thu Oct 29, 2020 12:34 pm
- Contact:
Re: Advanced search result bug
After testing usu_cleanse function I've decided to completely remove it. This was used to allow only alphanumerical characters into HTML queries. That blocks the usage of {} for shopping cart links or spaces for search results and would clean up any other character used for querystrings in any addon. I am not sure what was the reason the original author wrote it but I think it's pretty useless.
Can you please change usu_cleanse function in includes/apps/ultimate_seo_urls/includes/usu_general_functions.php to:
And let me know if you find any issue?
Can you please change usu_cleanse function in includes/apps/ultimate_seo_urls/includes/usu_general_functions.php to:
Code: Select all
function usu_cleanse( $value ) {
return $value; //deprecated function as several addons and stock search results uses special characters
}
-
- Posts: 96
- Joined: Thu Mar 11, 2021 2:16 am
- Contact:
Re: Advanced search result bug
Piernas wrote:After testing usu_cleanse function I've decided to completely remove it. This was used to allow only alphanumerical characters into HTML queries. That blocks the usage of {} for shopping cart links or spaces for search results and would clean up any other character used for querystrings in any addon. I am not sure what was the reason the original author wrote it but I think it's pretty useless.
Can you please change usu_cleanse function in includes/apps/ultimate_seo_urls/includes/usu_general_functions.php to:
And let me know if you find any issue?Code: Select all
function usu_cleanse( $value ) { return $value; //deprecated function as several addons and stock search results uses special characters }
Looks good. The search function now works and there does not seem to be a problem with the cart either. Thanks so much!
-
- VIP Member
- Posts: 119
- Joined: Thu Oct 29, 2020 12:34 pm
- Contact:
Re: Advanced search result bug
I found something else with the same behavior. When I search for something with a german umlaut like 'ä','ö','ü', the results are displayed, but when I click on an article, the "too many redirects" error message also appears. I've already tried the above changes, unfortunately without success.
Phoenix 1.0.8.16 USU 3.0.5 PHP 8
Phoenix 1.0.8.16 USU 3.0.5 PHP 8
-
- VIP Member
- Posts: 98
- Joined: Sat Oct 31, 2020 7:22 pm
- Contact:
Re: Advanced search result bug
By the way: The above fix also removes a problem which occured with google ads. When clicking on an ad, the "too many redirects" error message also appeared. But not anymore
-
- VIP Member
- Posts: 98
- Joined: Sat Oct 31, 2020 7:22 pm
- Contact:
Re: Advanced search result bug
I'll look ai it, I hadn't tried special characters yet.Denzel wrote:I found something else with the same behavior. When I search for something with a german umlaut like 'ä','ö','ü', the results are displayed, but when I click on an article, the "too many redirects" error message also appears. I've already tried the above changes, unfortunately without success.
Phoenix 1.0.8.16 USU 3.0.5 PHP 8
In the meanwhile, can you test if the same link works without the "keywords" querysting?
-
- Posts: 96
- Joined: Thu Mar 11, 2021 2:16 am
- Contact: