Osclass Support Forums

Osclass theme support => Delta Osclass Theme => Topic started by: morfik on March 10, 2023, 05:27:00 PM

Title: Searching for cities on the home page and on the publish page
Post 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?
Title: Re: Searching for cities on the home page and on the publish page
Post by: MB Themes on March 10, 2023, 07:44:33 PM
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?
Title: Re: Searching for cities on the home page and on the publish page
Post by: morfik on March 10, 2023, 07:58:55 PM
No, it's with all Polish characters.

Here's the list:
https://en.wikipedia.org/wiki/Polish_alphabet#Computer_encoding
Title: Re: Searching for cities on the home page and on the publish page
Post by: MB Themes on March 15, 2023, 01:46:21 PM
@morfik
That's clear to me :D

In global.js find this line (line 39):
Code: [Select]
var term = ($(this).val()).trim();
Below this line add:
Code: [Select]
term = term.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
It should change Śliwno into Sliwno and search just without special char using jquery regex.
Title: Re: Searching for cities on the home page and on the publish page
Post by: morfik on March 15, 2023, 02:06:56 PM
Yes, it does. So what about the other letters? Should I add more lines like the one you've provided?
Title: Re: Searching for cities on the home page and on the publish page
Post by: MB Themes on March 15, 2023, 02:18:25 PM
@morfik
It's not letter-specific fix  ::)
Title: Re: Searching for cities on the home page and on the publish page
Post by: morfik on March 15, 2023, 02:19:32 PM
So it should work for all of the Polish letters?
Title: Re: Searching for cities on the home page and on the publish page
Post by: MB Themes on March 15, 2023, 02:20:41 PM
I always prefer first try and then ask
Title: Re: Searching for cities on the home page and on the publish page
Post by: morfik on March 15, 2023, 02:22:40 PM
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.
Title: Re: Searching for cities on the home page and on the publish page
Post by: MB Themes on March 15, 2023, 02:37:31 PM
Maybe there is some conflict. How to reproduce?
Title: Re: Searching for cities on the home page and on the publish page
Post by: morfik on March 15, 2023, 03:07:25 PM
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.