Startseite › Toolset Professional Support › [Gelöst] If a user choose a category or anything in the search form, it not shows correct
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.
Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | - |
- | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | - |
Supporter timezone: Europe/London (GMT+00:00)
Tags: Custom search, Plugin Views
Verwandte Dokumentation:
Dieses Thema enthält 21 Antworten, hat 2 Stimmen.
Zuletzt aktualisiert von fred-r.M vor 5 Jahren, 1 Monat.
Assistiert von: Nigel.
If a user choose anything in the search form: versteckter Link
it not showing the whole results correct.
Also - in firefox it shows nothing. For "not showing" the results before a customer choose something I have a script:
<code:<script>
function Search() {
document.getElementById("myresults").style.display = "block";
}
</script>[/php]
Link to a page where the issue can be seen: versteckter Link
Sprachen: Englisch (English ) Spanisch (Español )
Zeitzone: Europe/London (GMT+00:00)
Firstly, there are better ways to not show any initial results before a selection has been made than hiding the results with CSS (which means that the results still get sent to the browser).
You can wrap the wpv-loop section of your View in a conditional shortcode which tests for the presence of a URL parameter that gets added when a search filter is applied, and only show the loop when that parameter exists (otherwise it is the first visit to the page and no search has been specified yet).
Here is how that would look:
[wpv-layout-start] [wpv-items-found] <!-- wpv-loop-start --> [wpv-conditional if="( '[wpv-search-term param='wpv_view_count']' ne '' )"] <wpv-loop> <!-- you loop content goes here --> </wpv-loop> [/wpv-conditional] <!-- wpv-loop-end --> [/wpv-items-found] [wpv-no-items-found] <strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong> [/wpv-no-items-found] [wpv-layout-end]
Now, if I expose the results on your page (by changing the #myresults to display:block) then the results are all in a narrow column on the left. I'm having problems understanding the markup because your View appears to be inserted multiple times (presumably related to the map displayed at the top), and you are using a page builder.
Can I look at your site to see?
I will mark your next reply as private so that I can get log-in credentials from you—you may want to create a temporary admin user for me to use that you can later delete. And be sure to have a current backup of your site.
Sprachen: Englisch (English ) Spanisch (Español )
Zeitzone: Europe/London (GMT+00:00)
I can't work out where you added the custom JS and CSS to hide the results to be able to look at them without that modification.
Could you please disable that and then let me know when you've done that?
Dear Nigel
I added it in Impreza -> Theme Options -> Custom Code
Finally I taked the js code out now
And the css code was in the child theme style.css, I taked it out there too.
Sprachen: Englisch (English ) Spanisch (Español )
Zeitzone: Europe/London (GMT+00:00)
So, why can't I see any results on the Phuket page, then?
Hi Nigel
It is working - respectively - the result is there, without choosing anything: versteckter Link
Do You might have an issue with the cache?
Dear Nigel
Are You still on this ticket?
Regards,
Simon
Sprachen: Englisch (English ) Spanisch (Español )
Zeitzone: Europe/London (GMT+00:00)
Yes, sorry, I don't work at the weekend. I've just started and will get back to this this morning.
Sprachen: Englisch (English ) Spanisch (Español )
Zeitzone: Europe/London (GMT+00:00)
OK, the page appears to be working now, and it looks to be working as expected, so I'm not sure any longer what the problem is I'm supposed to be addressing?
Hi Nigel
The main thing is, I not want, that the results are showing from the beginning. It used to start show, when a customer change anything in the search form (dropdowns, or do a fulltext search).
Sprachen: Englisch (English ) Spanisch (Español )
Zeitzone: Europe/London (GMT+00:00)
The let me refer you back to my first answer, which is I think the easiest way to implement this.
You just need to add the opening and closing wpv-conditional shortcodes around the wpv-loop tags, as shown in the sample code.
Dear Nigel
I did, but it still showing all listings in the beginning. Or do I need to set something special or anything else in the view?
Regards,
Sprachen: Englisch (English ) Spanisch (Español )
Zeitzone: Europe/London (GMT+00:00)
It seems you added back the CSS to set display:none on the results, so I can't test if it is working.
Hi Nigel
I did not set anything back or so. It is loading after a few seconds, and then it is loading all the times. But this is not what I want. I just need to get a solution.
Maybe there is something wrong in the Pagination and Sliders Settings or in the Custom Search Settings.
Regards,
Sprachen: Englisch (English ) Spanisch (Español )
Zeitzone: Europe/London (GMT+00:00)
Something odd with the caching, because when I visited the page the section had the CSS display:none rule set.
In any case, what you describe I would say is expected.
You have turned on automatic pagination that shows 20 results at a time, updating after every 5 seconds.
So, on your initial page load, the condition—which is essentially checking if this is the first time the View has loaded—fails and nothing is shown.
Then after 5 seconds the page updates with automatic pagination, and so now this is not the first time the View loaded, and hence the results are shown.
You could use a similar technique with the wpv-conditional shortcodes, but you would have to add a test for each of the filters you include in the search form (the existing test is for a generic parameter that is added whenever the View results are updated, including with pagination).
Or you could use the wpv_filter_query API filter where you modify the query to return no results unless a search term is specified, which is probably the best solution in this case where you are automatically paginating results, the only limitation being that you need to remove the "No items found" text, so that nothing would be displayed if someone performed a search and there were no results found.
I can help with that if that sounds okay...