Sorting Invoice / Packing Slip By Product Code? Help Appreciated

I cannot figure out how to sort the products on the invoice or packing slip by the product code instead of product name. I've searched endless forums, and I am starting to believe this is not simple.

I appreciate any solution offered for this in advance.

Thank you,


The products on the invoice are sorted by name and this is directly entered in the function fn_get_order_info. You can not influence it in any way. You need to handle on hook in this function and once again take the products with sorting them as you like. You need to create a small addon.

Best regards


In the fn_get_order_info function (app/functions/fn.cart.php) use get_order_info hook to add the following line of code

$order['products'] = fn_sort_array_by_key($order['products'], 'product_code');

Totally worked!

eCom Labs, I want you to be my new best friend. I owe you big time, thanks for the effort.

If there is a way I can bless you in return, let me know.

You are welcome! :)