Skip Navigation

[Resolved] Getting search form to work using custom taxonomy in a view

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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 16 replies, has 3 voices.

Last updated by Waqar 1 year, 11 months ago.

Assisted by: Waqar.

Author
Posts
#2486425
Screenshot 2022-10-28 at 17-21-48 Edit View ‹ Dairy King — WordPress.png
Edit_View_‹_Dairy_King_—_WordPress_-_2022-10-29_18.15.29.png
Edit_Taxonomy_‹_Dairy_King_—_WordPress_-_2022-10-30_09.56.16.png

Tell us what you are trying to do?
In a previously existing view, I'm trying to redo a search by category select field but using a custom taxonomy instead of just categories. The new taxonomy is product-category but when I change it to the new taxonomy, I can't save the view.

Is there any documentation that you are following?
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/

Is there a similar example that we can see?
Yes, hidden link

What is the link to your site?
hidden link

#2486725

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi there

From your screenshots it looks like the problem may be that you are trying to add a front-end filter for something where you already have a fixed query filter applied.

So you have an existing taxonomy filter for product-categories (where all the categories are checked).

But you now want to add a front-end filter for the same product-categories taxonomy, which means the View needs to set up a query filter based on the URL parameter that gets added when the filter is applied on the front end.

Before going any further I would delete that existing taxonomy query filter, and then try setting up the front-end filter again.

Does that enable you to save the View?

#2488009
Edit_View_‹_Dairy_King_—_WordPress_-_2022-11-02_12.41.41.png

Yes, If I delete that div with the reference to wpv-control taxonomy, I can save that Search and Pagination section.

So the search input box works just fine. Not an issue. It's all about the Select menu.

So based on what I currently have setup in my Query Filter, did I do that right in order to get that Select menu to appear appropriately?

Again, the idea is to have the select menu populate with the different categories and selecting one of them takes you to a results page like this one on the live site: hidden link

Only difference here is it's pulling Categories and not a custom taxonomy.

#2488695

Hi,

Thank you for writing back.

I've checked the search form on the page that you shared and the search for the product category taxonomy seems to be working correctly.

Now, if you'd like to include another search field for a different custom taxonomy, you can add it using the "New filter" button available in the "Search and Pagination" section.
( screenshot: hidden link )

In case you have some different requirements in mind, you're welcome to share more details and I'll be happy to guide you with the next steps, accordingly.

regards,
Waqar

#2489053
Edit_View_‹_Dairy_King_—_WordPress_-_2022-11-03_16.45.13.png

I'm trying to, but the taxonomy I want to use for my search, Product Categories, is ghosted out. I can't select it.

#2489063
Edit_View_‹_Dairy_King_—_WordPress_-_2022-11-03_16.55.14.png
Edit_View_‹_Dairy_King_—_WordPress_-_2022-11-03_16.54.07.png

OK, I figured out that I needed to delete the previous taxonomy in this view. So then I could go to New Filter and create my filter.

Which didn't work.

Still says I can't save the section.

#2489397

In your screenshots, I noticed the incorrect syntax for the submit button shortcode "wpv-filter-submit".
( screenshot: hidden link )

Can you please correct it as follows and see if you're able to save the view?


[wpv-filter-submit name="Search" type="button" class="btn-search"]

#2489765

No, I still cannot save the view.

Only when I delete the Product Categories filter can I save it.

Something is very, very wrong.

#2491207

Since I can't reproduce this issue on my test website, it looks like something specific to your website is involved.

Can you please share the temporary admin login details of the website, along with the name of the affected view?

Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.

#2495881

Thank you for sharing these details.

The login details work, but it doesn't allow access to any of the admin area sections.

Can you please assign the "Super Admin" user role to this temporary user?

#2496441

Done. Should be a SA now.

#2496783

Thank you for allowing the super admin access.

I don't see any website named "Dairy King" in the network. I just see the "Dairy Berries" website and it doesn't have the "Products" post type or the "Product Categories" taxonomy.

There is just one view on that website, named 'Product Search Form and Results' and it is also not completely set up.

Am I looking into the wrong website or have you made any changes to it?

#2497031
Screenshot 2022-11-15 at 12.45.28 PM.png

You are. Why don't you try hidden link to get there directly. But there's four sites in this network.

#2497255

Thanks for writing back.

I can access that website's admin area if I use the link directly, but for some reason, it is not showing in the "My Sites" network menu.
( screenshot: hidden link )

Based on some basic tests, it seems that something on the server is interfering with the AJAX calls which are responsible for saving setting the taxonomy query filter and saving the view.
( I see an error with 406 code for the relevant AJAX calls in the browser's console )

To troubleshoot this, I'll suggest the following steps:

1. Please make sure that WordPress, active themes, and plugins are all updated to the latest versions.

2. It would be interesting to test this with all non-Toolset plugins disabled and a default theme like Twenty Twenty-One.

If it's fixed, you can start adding the disabled items, one by one, to narrow down to a possible conflicting one.

3. In case the issue still persists, I'll need your permission to download a clone/snapshot of this website, to investigate this on a different server.

I hope this helps and please let me know how it goes.

#2499237

Hmmm.... perhaps it is your browser caching?

I think I did this before, at least with the plugins, but whatever the case, deactivating plugins and switching themes did not work.

Yes, you have my permission to download.