Made advanced inventory sort items

Adresses issue #1826.