Magento CE 1.9.1 - I have a custom attribute (Scott #) which essentially is a stamp catalog number. When the frontend sorts the display by Scott #, it was fine until I hit number 100. Now, it is putting catalog number 101 after number 1, rather than after number 99. How can I fix this? Thank you!
1 Answer
This sort is made by MySQL ORDER BY
. You need natural sort but MySQL doesn't support it. That's why you have to make some workarounds on the MySQL query which is a little bit ugly. Or to sort the collection with php natsort()
. Or the easiest solution - just add zeros before the numbers (i.e. 1 to become 001).
ORDER BY
. You need natural sort but MySQL doesn't support it. That's why you have to make some workarounds on the MySQL query which is a little bit ugly. Or to sort the collection with phpnatsort()
. Or the easiest solution - just add zeros before the numbers (i.e. 1 to become 001).