Skip Navigation

[Resolved] AJAX filter not working properly

This support ticket is created 7 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 80 replies, has 3 voices.

Last updated by nadavR 6 years, 7 months ago.

Assisted by: Beda.

Author
Posts
#580419

Hi Beda,

Thanks for your answer. First, you are correct that Toolset was updated a few months ago from a version that precedes September 27, 2016.

Second, I have a test site up and running and, installed your code and gave it a spin. It seems to work fine - but only in Music. All of the other art forms still behave the same as the live site (links to all of them in the first message in the thread: #575192). Please advise, thanks!

Nadav

#580465

Excellent.

I think the issue you find on the posts with other taxonomy terms, is because those are own other pages (the searches) and the code needs to be run there as well.

Please let me investigate this and update you.

#580586

Hi Beda,
Just to clarify: all the different art forms are running the same View, initially filtering artform via the shortcode. Then, the AJAX filter for each artform has both “shared” items (Type and Country) as well as unique drop downs for each art form (such as Instrument and Genre in Music, and Speciality in Visual Arts, etc)

#580680

Looking into your code now, I'm seeing this line:

$neede_meta_keys = "'wpcf-instrument','wpcf-music-genres'"; //excluded metas ,'wpcf-artist-type','wpcf-country'

Maybe that's the issue? It seems to pick up only music related fields.

#580727

Hi Beda,

I figured why not try to add the remaining field names to the line so that it looks like this:

$neede_meta_keys = "'wpcf-instrument','wpcf-music-genres','wpcf-theater-specialty','wpcf-theater-style','wpcf-dance-specialty','wpcf-dance-style','wpcf-film-specialty','wpcf-film-genre','wpcf-visual-arts-specialty'"; //excluded metas ,'wpcf-artist-type','wpcf-country'

Now, it seems to work fine on my test site. However, if I follow your instructions (from message #580166) and remove the code after navigating to each of these pages, and then add *new* artists, those new artists are not filtering correctly. Does that mean I would need to keep the code in functions.php? Is this a code that can stay on the site or is it only meant to be used and then removed?

Many thanks,
Nadav

#580781

I misunderstood initially.
Hence yes, this is the right solution:
https://toolset.com/forums/topic/ajax-filter-not-working-properly/page/4/#post-580727

Now, adding new items should not provoke the issue.
But, as a senior developer found out yesterday, there is a BUG since a while in Views, and it produces what you see.

We are already working on this now. For you, right now, I think the best would be to run the code when you add new fields.
The problem is that you probably still have "save 0 to the database" in your Fields settings.
And it seems that Views reads this wrong.

If you can wait for a fix, I would suggest to not add new posts right now. I will push for a fast fix

#580799

Hi Beda,

New artists are added by the artists themselves, not me. I can’t prevent people from doing that on the live site.

Since you are working on fixing this bug, I will wait for your solution before changing anything on the live site.

Thanks,
Nadav

#582012

Hi Beda,

Just following up, is there news about our issue?
Also, should I avoid updating Toolset plugins on the live site in the meanwhile?

Thanks,
Nadav

#582680

There is a fix planned for the upcoming release of Views 2.5.1

I cannot yet produce an erratum (hot fix) for this.

I will update you immediately when I have an official fix.

#583557

Thanks Beda, keep me posted.

#588986

Hi Beda, following up, any news on the solution / estimated time for release date with bugfix?

#589957

Hi Beda, following up again as I haven't received any response from you. Please let me know where this issue stands, thanks.

#590268

I am sorry, this ticket escaped my attention as it's escalated to the Developers, and there has been no solution so far. Hence I did not update here.

I pushed (again) for a prompt solution.
The issue is planned to be fixed in the upcoming Views release 2.5.2

I apologize that my hands are bound, I cannot accelerate this more than I did.
I keep pushing for a fast solution and will update you here as soon I have something to provide to you.

#590329

Hi Beda, thanks for your answer. When is Views 2.5.2 due?

#595998

Hi, it's been two and a half weeks since my last message and over two months since I brought up the issue for the first time. I haven't seen any solution until now, can you please give me a clear estimate for when you can solve this? My client – and my company – are very upset and unsatisfied with this situation.

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.