Forums › Forums › Search & Filter Pro › Custom Sorting is not showing all results
Tagged: sorting
- This topic has 44 replies, 3 voices, and was last updated 5 years, 3 months ago by Ross.
-
Anonymous(Private) September 6, 2019 at 2:29 pm #220426
Hi there –
I want to use custom sorting of my query results in order to get my bundle products displayed on top of the page.
I therefore added a custom field with “bundle-types” so bundles have e.g. “1” and no bundles “undefined”.
If I sort by bundle-types only bundles are shown – nothing else. I don’t want to add bundly-types to all products subsequently.
I did not find a metadata filed indicating the product type (bundle or simple-product) that I could use for sorting instead.
What would be an easy way to achieve that?Thanks,
Paul
Trevor(Private) September 6, 2019 at 3:33 pm #220435If the custom field for a given post has no value, with the way WordPress works, there is no entry at all for that custom field for that post. It isn’t empty as such, it doesn’t exist. So, if you sort by that, all the posts without a value will disappear. Every post MUST have a value, as this is the only way to fix this.
Trevor(Private) September 6, 2019 at 3:43 pm #220447You might be able to use this filter:
https://searchandfilter.com/documentation/action-filter-reference/#edit-query-arguments
Trevor(Private) September 9, 2019 at 4:25 pm #220534The code goes in to the child theme functions.php file. You will need to code it yourself, but it might look like the example this user made:
https://support.searchandfilter.com/forums/topic/changing-the-deafult-order/#post-207512
-
AuthorPosts