-
-
Save tivuno/00d5ebcbfd3efc84ae3af0850ca60c51 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$search_query = "XXX"; | |
// Correct search query | |
$search_query = preg_replace('/([25]){1,}/', '25', $search_query); | |
// Example: We search for ”λάμπα” and this is converted to ”%CE%BB%CE%AC%CE%BC%CF%80%CE%B1” | |
// which then re-converted and so on. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Case study
Human in need: @prestan0ob
Website: marketnet.gr
No results when returning to a search page after visiting a product.
Steps to reproduce
Our approach
When going back, for some strange reason when the first time the search_query parameter has the characters encoded with %25 then adds more 25s in the link which leads to - obviously - no results, as it's a whole different story.
So we just convert the query to ”translate” it once again.
You just replace XXX with your own configuration.
Further fine tuning
The H1 tag which contains the search_query is escaped and the beautified text is properly displayed. On the same time, the string in the search bar is not. So you have to edit your tpl file and escape it there, as well.
Cheers