Hi Guys
I want to order by a Featured List of product ids - which is passed from PHP. So firstly it orders by the featured list, then it falls back and orders by price. I have tried the following, but it seems to pull the featured ones last, not first.
...ORDER BY ( CASE p2.product_id WHEN 4 THEN 0 WHEN 33 THEN 1 WHEN 22 THEN 2 WHEN 20 THEN 3 WHEN 16 THEN 4 WHEN 27 THEN 5 END ) ASC, pa1.price ASC
So ideally the order would be:
- product_id = 4 (if it is found by the query)
- product_id = 33 (if it is found by the query)
- product_id = 22 (if it is found by the query)
- product_id = 20 (if it is found by the query)
- product_id = 16 (if it is found by the query)
- product_id = 27 (if it is found by the query)
- Everything else that is found by the query, in price ASC order.
Hope that makes sense.
Thanks