The sort mechanism is already built by xcart just they haven't switched it on.
Just add a link to the top of the products.tpl
Sort this list by Price
And amend the navigation.tpl as shown
Then amend products.php by adding the assign to smarty code at the bottom.
You dont need to amend the sql query in any way.