[Resolved] Reorder product display on the unfiltered archive start pages
This support ticket is created 4 years, 5 months 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.
I filled my clients product database with their individual products and made an archive page that displays the first 12 products on the start page. I also added a filter section at the top.
Now if no filters are used (start) he wants to show the first 12 products in a specific order (different from what is showing now).
Another issue is that my client wants the display of the search part less dominant on the top of the page. Is it possible to hide the search part behind a fold out kind of thing or move it to the left side bar (they want to products more dominant on the top of the page)
To add such manual order, you should add a custom field that holds the order of the product and later we can use that custom field for your product ordering.
So, basically, you should add a new custom field and add it to any of your custom field group "Default order" and assign this custom field your required order. And later using hook we can set the order by this custom field.
Does that makes sense?
Regarding your additional query, I will create split ticket but lets resolve your original issue that you reported with this ticket first.
You mean add a numeric custom field in the present "veldgroep voor producten" or a complete new "add custom field"?
In this numeric custom field give each sgl product a number (1 for the first product to show etc..)?
If so then give only the first 12 products a order number and the rest not (so they will be published randomly as present)?
That is up to you, if you want to create a new custom field group that holds the numeric custom field that holds the order value or you want to add the new custom field to your existing custom field group.
In this numeric custom field give each sgl product a number (1 for the first product to show etc..)?
==>
Yes.
If so then give only the first 12 products a order number and the rest not (so they will be published randomly as present)?
==>
We will use the view's hook "wpv_filter_query" and add the orderby argument on fly using the custom field. So, it will display the products where you assigned the order.
- https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query
I made a custom field - products view order number - in my field group for products
After that i numbered the 12 most important of the 30 products
Now i think i can choose a query filter in the archive page view and choose the above custom field in the query list (see screenshot)
==>
No, you should sort the product by your custom field from the ordering section and set number like 9999 to the remaining products you want to display at last.
So better to number all products.
Is my assumption of using the query filter as mentioned above (screenshot) the proper way?
Looks quite simple if that is all or am i thinking to simple?
Is my assumption of using the query filter as mentioned above (screenshot) the proper way?
==>
No, as I already inform you in my previous reply that you should not use the "Query Filter" but you will require to use the "Ordering Settings" Section of your block view.
"Query Filter" section is used to add the query filers when you want to display the filtered posts.
In your case, you want to sort the results and for sorting, you need to go to "Ordering Settings" section and add the sorting custom field you created that holds the sort order.