You completely missed the wisdom in the thread I referenced
a) put the required custom code into a custom tpl_footer.php file
b) the order number can be found in $order_summary['order_number']
and the order amount will be in $order_summary['commissionable_order']



