Perhaps I am missing something, but I don't see how this solves the problem. The colors must be sorted alphabetically in two groups. The first group should be those with quantities above 0 and the second group should be 0. As you have described it, they will be ordered first by quantity (correctly putting all colors with quantities in front of those without) but within the groups you will have the wrong alphabetical order.