the fact that you are looking at diffs suggests to me you are perhaps not running the latest code set
as determined by me and verified by @torvista, the latest code does not do this correctly. and the fix i provided does address this issue.
neither one of us is seeing this behavior. the product sorting seems to sort fine and there is no redirect when changing the product sort order that causes you to go back to a category listing.
as you said, i would look at the difference in your code and what is on the latest codeset. but you did point out a verified bug in the existing code set; thank you for that!
best.
Bookmarks