Slightly unusual case. I've got a Drupal Commerce store making hand-made goods, where the client wants sold stock to be visible in product list views marked as sold out, always at the end of every list, so that people who've browsed all the available stock without finding what they want can get ideas based on products that have been made before and could put in a request for something like a previously sold product to be made.
So, I want a sort that takes the commerce stock field, which is a fairly ordinary numeric field, and sorts on it, but treating all numbers greater than or equal to 1 as 1.
The conversion is easy, the sorting algorithm would be easy to code, and I'm sure this could be done with a very small custom module hook somewhere in the Views sort process - I'm just not sure which of the many Views hooks would be the appropriate position in the views sorting process to modify the field value like this. Also, there might be a better way. I'd prefer not to create a duplicate boolean field then sort on that, as it might end up out of sync.
How can I sort on a numeric field like it was a boolean field like this?