Using the above, I get an array of Active Record. What I want is an array of distinct product category. I am aware that I need to do a loop through and build array myself.
Is there a way to just get an array of distinct product category ?
You’ll always get an array of Products from that query. What might make more sense would be to use CDbCommand to get the results you want and encapsulate that in a static method in the Product object. The above query should give you one product per category though.