Forums › Forums › Search & Filter Pro › Combo box resets after selection
- This topic has 10 replies, 2 voices, and was last updated 9 years, 5 months ago by
Ross.
-
Anonymous(Private) March 10, 2016 at 4:10 am #39121
This is what is happening:
https://dl.dropboxusercontent.com/u/2486999/Ugh.gif
The other fields work just fine, but when I select on a combo box it doesn’t take the selection. It resets to nothing selected.
I was having the same problem with a slider for that field. I’ve disabled all plugins and I’m using the stock wordpress theme.
Any suggestions?
Ross Moderator(Private) March 14, 2016 at 10:33 am #39362Very odd, do you have a link online I could look at?
Thanks
Anonymous(Private) March 15, 2016 at 1:15 am #39417I’m developing locally, so it isn’t live yet.
I’m pretty sure I’ve found the cause – any post meta with a space in the key causes the odd behavior. But WordPress doesn’t care about spaces in meta keys, and doesn’t prevent their creation.
Advice on fixing?
Ross Moderator(Private) March 15, 2016 at 8:39 am #39424I guess avoid for now, I’ll have to take a look into this and patch if necessary.
Thanks
Anonymous(Private) March 30, 2016 at 10:43 pm #41057The url isn’t an issue since spaces are completely supported in meta values and passed through the url. They encode to %20.
The site was built adding meta information directly through wordpress on the edit post page, not through a plugin. And wordpress documentation is pretty clear that any string can be a meta key.
I dug through the code and the issue is in the init_filters function in class-search-filter-cache.php where there is an incorrect comparison. There are a bunch of if(isset($_GET[$filter_name])) statements. When I dump $filter_name for the key “place of origin” it is “_sfm_place_of_origin” but $_GET is set as “_sfm_place of origin” so of course it isn’t found. And it would be found if there weren’t spaces in the key name.
I wrote in a workaround so I don’t need a refund.
Ross Moderator(Private) March 30, 2016 at 10:57 pm #41058Nice catch! Was it a simple fix? Perhaps something we can look at including in the next update – otherwise you’ll be looking at having to patch every release should you wish to update the plugin.
Thanks
Anonymous(Private) March 30, 2016 at 11:27 pm #41059I just looked at the fix (I did it over the weekend), and I had the variables backward in my previous response. $_GET has replaced spaces with underscores, $filter_name doesn’t. But to work around it, I just created a bonus variable replacing all the spaces in $filter_name with underscores and did all $_GET lookups with that instead. As far as I can tell, that fixed it.
I’m still testing to make sure.
Ross Moderator(Private) March 31, 2016 at 8:20 pm #41161Thanks for the info, I’ll have to take a look this area again and review!
Best
-
AuthorPosts