Hello. Leafing through foreach (products as product) I have on the page a lot of products like this:
[2] => Array ( [product_id] => 295 [viewed] => Array ( [0] => Array ( [chat_id] => 74 [message_id] => 162 [status] => 0 ) [1] => Array ( [chat_id] => 74 [message_id] => 163 [status] => 1 ) ) ) In SQL, sorting is not possible.
How can I do a sorting, so that goods where there is [status] => 0 are at the top of the list?
In other words, if there is at least one unread message in the chat, pick it up at the top of the list.