Here's the thing, I have product collection that I need to sort by their size. The size attribute values are XS, S, M, L, XL. When I put simply
addAttributeToSort('size', 'DESC')
it sorts them by alphabetical order of size attribute values (XS, XL, S, M, L).
Does anyone have any tip how to solve this?
Best I could think of is to create some new select field during the select process which will, through case
command, have values 1,2,3,4,5, depending on the size value, and the sort it by that. But I don't know how to do that, or if it's even possible in Magento.