[Resolved] Views plugin custom search with ajax stopped working
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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
So parts of my custom search which I created with the toolset view plugin suddenly stopped working after I updated it.
When I select "AJAX results update when visitors change any filter values" the search results won't update. Only when I select " Full page refresh when visitors click on the search button", then it works.
You can see it for yourself. Go to hidden link and view the Search Page.
Please help. I don't know what the problem is. I have only toolset plugins and themes activated.
I took a look at your site and see that there is quite a lot of custom JavaScript on the page in question.
So I reproduced your View without any customisations—Nigel Product Search—and added that to a page of the same name and tested it. If you do so yourself you will see that it works as expected.
I think you need to go through your View and revise the code you have added to see what is breaking the ajax updates. Try removing all of your customisations and then add them back in steps to help isolate the problem.
Helllo. I think it's the content template or the layout because when I add just the view with all of it's custom javascript inside the post body of a page it works just fine.
I tested it right here: hidden link
I don't use any custom js inside the the content template.
And you need this to work on the WooCommerce shop page specifically?
Those DIVs with the sfc-campaign classes, is there anything significant about those classnames (i.e. relate to functionality of another plugin or the theme) or they are classnames you made up?
I was just looking at this again, trying to recreate the issue on a local test site to abstract from any other issues on your own site.
I can reproduce the problem (although whether the views shortcodes are wrapped in DIVs seems to be a red herring), nor does it matter that you design the page with Layouts.
The problem can be reproduced adding the custom search View to a static page and then assigning that page to the WooCommerce shop page.
It is expected to find products on that page, but you are adding the View for another post type.
I'm not even sure this is expected to work, and I'm waiting for feedback from colleagues for their opinion.
I'll post an update here when I hear back from them.
You said ".. but you are adding the View for another post type".
The post type is actually the products post type.
I'd like to design the woocommerce shop page and add a custom view to it. I thought toolset layouts and content templates will do the job.
How would I design the woocommerce shop page apart from that?
I mean it works very well for now except for this little bug.
Sorry Nick, I must have overlooked that when I checked your site.
Well, the shop page is for the product archive. So the correct way to customise it is to created a custom archive at Toolset > WordPress Archives for products, which can include ajax filters.
The templates and WC compatibility functionality are made in the expectation that the product archive will be on the shop page. You are adding a View to display products, which is similar but not the same.
Is there some reason you can't create a custom WordPress archive?
Thanks for the hint.
So I just assigned the layout to the the archive for the shop page as you suggested.
The AJAX filter is still not working. hidden link
The reasons why I don't want to use a custom archive is because of SEO purposes.
Products are related to the shop page and tools like Yoast SEO make use of that principle.
Their breadcrumbs will never link back to the custom archive you suggest creating, but to the shop page.