I am not sure that the title is saying it right, most probably it does not 🙂
So I have products table and I want to order them by the season they are made for.
If ‘spring’ is 1, ‘summer’ – 2 , ‘autumn’ – 3 and ‘winter’ – 4, how can I order them in such way so it shows the ‘summer’ first, then ‘spring’, then ‘winter’ and at the end ‘autumn’. So like 2,1,4,3.
And to clarify it more, I want to be able to change the rule. It might be 2,1,4,3 or 4,2,1,3, etc. This is to show the season products on top.
Hope that explanation helps to get the problem. Any solutions are welcomed. Database is MySQL, language PHP.
Create a string of “season” ids. Then do the order by field thing:
Replace the 4, 2, 1, 3 part with interpolated php variable.