Sort by category functionality