Sort Invoice (Or Cart) By Product Code? 2.25

I know this question has been asked before but I have not seen any definitve replies.

I'm guessing that how items are sorted in the cart determines the invoice sorting as well.

Any help will be greatly appreciated!