Support Forums - Classified Ads Script Osclass
Osclass theme support => Delta Osclass Theme => Topic started by: morfik on March 10, 2023, 05:27:00 PM
-
There's a nice window in the delta theme on the home page which allows users to search for some city -- they simply select the city/region box and start typing. This window works just fine, i.e. when I search for śliwno , the popup with Śliwno appears and I can select it and the seach page with this city loads. It also react for the sliwno phrase which also shows Śliwno in the popup.
There's similar search box for region/cities on the publish ad page. So I select the region, the city filter box shows now cites, I type śliwno and nothing appears in the city filter. But when I type liwno without the Polish ś, the box shows Śliwno in the filter. It looks like the phrase sliwno also works here.
It looks like the two search city/region mechanisms use different semantics for returning results. So how to fix the publish page city/region search so it behaved the way the search city/region box on home page does?
-
Box on publish page only filter results those are already loaded by javascript.
In past we've been fixing it for romanian characters and it works just fine.
Is there problem just with that one character?
-
No, it's with all Polish characters.
Here's the list:
https://en.wikipedia.org/wiki/Polish_alphabet#Computer_encoding
-
@morfik
That's clear to me :D
In global.js find this line (line 39):
var term = ($(this).val()).trim();
Below this line add:
term = term.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
It should change Śliwno into Sliwno and search just without special char using jquery regex.
-
Yes, it does. So what about the other letters? Should I add more lines like the one you've provided?
-
@morfik
It's not letter-specific fix ::)
-
So it should work for all of the Polish letters?
-
I always prefer first try and then ask
-
Actually I did, but it looks like that the cache plugin doesn't work well with this city/region filters. I disabled it, and it looks like it works.
-
Maybe there is some conflict. How to reproduce?
-
Enable cache for home page for instance or where these filter fields are used.
Open the page, cache will be generated.
Try to search for a city using this filter.