[Gelöst] view Query Filter nor search parameters does not filter the results correctly
This support ticket is created vor 5 Jahre, 11 Monate. 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.
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.
I am trying to: pass a search parameter using url parameters to display a set of matching products
Link to a page where the issue can be seen: versteckter Link
I expected to see: the results on the page versteckter Link filtered based on the url parameters
Instead, I got: products that are not in the category of the value in the url parameter display and other filters are not working as well
see enclosed filter for the view settings.
you can test on the test page: versteckter Link to see available products and see the possible alternatives in the url search parameter but when you look into the product taxonomy value against the filter there is no match.
repro steps on the test page
select gender = female
click search - search results render versteckter Link
click the first product on the lest "Cypress DX test name"
the product page render - versteckter Link
click the Spec tab
you can see that the gender is set to male and not female.
the same goes for age group.
the URL parmeters i'm working with are:
pr - price - set by woocommerce product price
bt - bike type - set by woocommerce product category
ag - age group - woocommerce taxonomy set up with toolset
gn - gender - woocommerce taxonomy set up with toolsett
yr - year - woocommerce taxonomy set up with toolset
I modified the output of your View to show the taxonomies to make it easier to see whether the results are correct are not.
Here on the test site it is clear it is not working: versteckter Link
It is not obvious why, so I created a new test View with filters to check that it should be working with the existing data, and it does: versteckter Link
It works even if I delete the filter controls.
So there seems to be something very specific to your View that I can't readily identify.
Might I suggest you start with a new View, or edit mine, and replace the View you are currently using?
I just pinpoint the issue.
In short, I created a new view on my stage environment and worked step be step to test it. it all worked fine and as intended until I set the view "Ordering" to a custom field "order by = Field - Bike Score" AND use the following code to display only simple products on the page.
if the order by is set to "Post Date" the URL parameters works just fine with the code above. the minute I set it to the custom filed "order by = Field - Bike Score" the query string is been ignored.
the code above is located under snippets under the name "Get Product Type".
The custom code you added to modify that View was written at a time when you weren't adding other taxonomy filters.
Now that you have the current code replaces the taxonomy query generated by the filters, instead of being appended to it.
You can fix that with a minor tweak to the custom code, by editing this line so that it includes empty square brackets (so that the array element is appended to existing elements):
Thanks Nigel,
Your solution solved the issue and things are working as they intended t.
I highly appreciate your help with this.
Have a great weekend,
David
Dieses Ticket ist jetzt geschlossen. Wenn Sie ein Toolset Kunde sind und Hilfe benötigen, eröffnen Sie bitte ein neues Support-Ticket.