For anyone reading this and contemplating something similar I realized that referrer_key listed on the invoice wasn't nearly as useful as referrer_homepage. I modified the function as follows to make that happen:
Code:
function get_referrer_homepage($oID) {
global $db;
// -----
// Check to see if the specified order has an associated referrer commission ...
//
$sa_sql = 'SELECT r.referrer_key, r.referrer_homepage
FROM ' . TABLE_REFERRERS . ' r, ' . TABLE_COMMISSION . ' rc
WHERE rc.commission_orders_id = ' . (int)$oID . '
AND rc.commission_referrer_key = r.referrer_key';
$sa_info = $db->Execute($sa_sql);
return ($sa_info->EOF) ? false : $sa_info->fields['referrer_homepage'];
Then later on when calling the function:
Code:
<?php
if (get_referrer_homepage($oID) !== false) {
?>
<tr>
<td class="main"><b>Affiliate Key:</b></td>
<td class="main"><?php echo get_referrer_homepage($oID); ?></td>
</tr>
<?php
}
?>
Bookmarks