
Originally Posted by
jcbazemore
Hey Lat9 I just found out last night that instead of four products we're going to have about 15 products at launch. This being said I have a feature request for future versions (unless there's something I can modify to make this happen now.) Is it possible to have the referrer code listed somewhere on the invoice? We offer custom labeling for our coffee's and the label is determined by which organization the order is placed for. I know I can tell that by clicking on the referrer link next to the order in the Admin section, but it would be easier if we could see it on the invoices that are printed out and not be tied to a computer when slapping on labels!
Here's a snippet of code that determines whether an order included a commission and returns the referrer's code (or false if no code was found):
Code:
function get_referrer_key($oID) {
// -----
// Check to see if the specified order has an associated referrer commission ...
//
$sa_sql = 'SELECT r.referrer_key
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_key'];
}
and then use that function in /YOUR_ADMIN/invoice.php (for v1.5.1 around line 132), changing:
Code:
<tr>
<td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
<td class="main"><b><?php echo ENTRY_ORDER_ID . $oID; ?></b></td>
</tr>
<tr>
<td><table border="0" cellspacing="0" cellpadding="2">
<tr>
<td class="main"><strong><?php echo ENTRY_DATE_PURCHASED; ?></strong></td>
<td class="main"><?php echo zen_date_long($order->info['date_purchased']); ?></td>
</tr>
<tr>
<td class="main"><b><?php echo ENTRY_PAYMENT_METHOD; ?></b></td>
<td class="main"><?php echo $order->info['payment_method']; ?></td>
</tr>
to
Code:
<tr>
<td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
<td class="main"><b><?php echo ENTRY_ORDER_ID . $oID; ?></b></td>
</tr>
<tr>
<td><table border="0" cellspacing="0" cellpadding="2">
<tr>
<td class="main"><strong><?php echo ENTRY_DATE_PURCHASED; ?></strong></td>
<td class="main"><?php echo zen_date_long($order->info['date_purchased']); ?></td>
</tr>
<tr>
<td class="main"><b><?php echo ENTRY_PAYMENT_METHOD; ?></b></td>
<td class="main"><?php echo $order->info['payment_method']; ?></td>
</tr>
<?php
if (get_referrer_key($oID) !== false) {
?>
<tr>
<td class="main"><b>Affiliate Code:</b></td>
<td class="main"><?php echo get_referrer_key($oID); ?></td>
</tr>
<?php
}
?>
You can place the function definition at the top of invoice.php, just after the "require" statement for application_top.php.
Bookmarks