I needed to modify the Ubercart invoice template. This invoice template appears to the user online and in email and is also used by the store admin to review/print/email/etc. invoices.
I needed to do some light modifications like; modify "Products on order:" to list products one per line as well as sort products by model (a SKU in my case).
<?php if (is_array($order->products)) {
$context = array(
'revision' => 'formatted',
'type' => 'order_product',
'subject' => array(
'order' => $order,
),
);
// function to compare 2 objects by 'model' attribute
function model_cmp($a, $b)
{
if( $a->model == $b->model ){ return 0 ; }
return ($a->model < $b->model) ? -1 : 1;
}
// sort the product array by model
usort($order->products, "model_cmp");