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.
I have a view for products where the primary sorting is based on whether or not the product is in stock. The secondary sorting is then set to by based on the post date. The secondary sorting simply isn't working. I changed the post date so that products would sort in a specific order with the eggs and poultry at the top, and hens and merch under those.
Can you help me out. The page is here: hidden link
Thank you for contacting us and I'd be happy to assist.
To troubleshoot this, I'll need to see how this Shop Archive page is set up in the admin area.
Can you please share temporary admin login details, in reply to this message?
Note: Your next reply will be private and please make a complete backup copy, before sharing the access details.
Thank you for sharing these details.
During troubleshooting, I noticed that the "Products" view's order setting is working as expected.
Here is a screenshot showing each product's stock and post date, in the view's results.
Based on the settings, the product's stock quantity is used for ordering the results, as primary criteria. The secondary ordering based on post date will only come into consideration when any products will have the same stock quantity. For all the products with the same stock quantity, the order will be selected based on the secondary ordering, which is post date.
Tip: For an absolute control over the order of the products, you can set custom numbers in the "Menu order" field and then order the view's results based on this (as primary criteria and not secondary).
( screenshot: hidden link )
Hi Waqar, thank you for taking the time to look. Unfortunately, it's not working—your screenshot actually proves that the secondary sorting isn't working. If you look in your screenshot you'll see that there are some items with post dates before others of the same primary sorting, but being displayed *after* them (e.g. view the "Medium One Dozen Eggs" with a post date of April 1, 2020, being displayed after "Chicken Breasts" which was dated April 5, 2020.
I also tried the "Menu Order" as a secondary control in place of the post date, and this is not working either. I added this as an Admin Column for easy and quick editing (screenshot), and if you compare it to the front-end view, you'll see that again, it's not working properly.
I'd be happy with either one working. And I think Menu Order would be preferable, but neither are currently working.
Thanks for writing back and I apologize as my last message couldn't end the confusion around how primary and secondary sorting works.
In my screenshot, the product "Medium One Dozen Eggs" is showing after the product "Chicken Breasts" because the "Chicken Breasts" stock quantity is '28', which is greater than the stock quantity '23', of the product "Medium One Dozen Eggs". If both these products had the same stock quantity (primary ordering criteria), then the decision would have been made on the basis of post date (secondary ordering criteria).
So in summary, you're thinking that the primary and secondary ordering works at the same time, but that is not true. The secondary ordering criteria only is used when there is a tie between the two items, based on the primary ordering criteria.
This is why I recommended using "menu order" as the primary ordering criteria, and not as the secondary ordering criteria.
I hope this makes it more clear.