[ Index ] |
PHP Cross Reference of osCMax 2.0.4 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 $Id: affiliate_statistics.php 14 2006-07-28 17:42:07Z user $ 4 5 OSC-Affiliate 6 7 Contribution based on: 8 9 osCMax Power E-Commerce 10 http://oscdox.com 11 12 Copyright 2006 osCMax 13 14 Released under the GNU General Public License 15 */ 16 17 require ('includes/application_top.php'); 18 19 require (DIR_WS_CLASSES . 'currencies.php'); 20 $currencies = new currencies(); 21 22 $affiliate_banner_history_raw = "select sum(affiliate_banners_shown) as count from " . TABLE_AFFILIATE_BANNERS_HISTORY . " where affiliate_banners_affiliate_id = '" . $HTTP_GET_VARS['acID'] . "'"; 23 $affiliate_banner_history_query = tep_db_query($affiliate_banner_history_raw); 24 $affiliate_banner_history = tep_db_fetch_array($affiliate_banner_history_query); 25 $affiliate_impressions = $affiliate_banner_history['count']; 26 if ($affiliate_impressions == 0) $affiliate_impressions = "n/a"; 27 28 $affiliate_query = tep_db_query("select * from " . TABLE_AFFILIATE . " where affiliate_id ='" . $HTTP_GET_VARS['acID'] . "'"); 29 30 $affiliate = tep_db_fetch_array($affiliate_query); 31 $affiliate_percent = 0; 32 $affiliate_percent = $affiliate['affiliate_commission_percent']; 33 if ($affiliate_percent < AFFILIATE_PERCENT) $affiliate_percent = AFFILIATE_PERCENT; 34 35 $affiliate_clickthroughs_raw = "select count(*) as count from " . TABLE_AFFILIATE_CLICKTHROUGHS . " where affiliate_id = '" . $HTTP_GET_VARS['acID'] . "'"; 36 $affiliate_clickthroughs_query = tep_db_query($affiliate_clickthroughs_raw); 37 $affiliate_clickthroughs = tep_db_fetch_array($affiliate_clickthroughs_query); 38 $affiliate_clickthroughs = $affiliate_clickthroughs['count']; 39 40 $affiliate_sales_raw = " 41 select count(*) as count, sum(affiliate_value) as total, sum(affiliate_payment) as payment from " . TABLE_AFFILIATE_SALES . " a 42 left join " . TABLE_ORDERS . " o on (a.affiliate_orders_id=o.orders_id) 43 where a.affiliate_id = '" . $HTTP_GET_VARS['acID'] . "' and o.orders_status >= " . AFFILIATE_PAYMENT_ORDER_MIN_STATUS . " 44 "; 45 $affiliate_sales_query = tep_db_query($affiliate_sales_raw); 46 $affiliate_sales = tep_db_fetch_array($affiliate_sales_query); 47 48 $affiliate_transactions=$affiliate_sales['count']; 49 if ($affiliate_clickthroughs > 0) { 50 $affiliate_conversions = tep_round(($affiliate_transactions / $affiliate_clickthroughs)*100,2) . "%"; 51 } else { 52 $affiliate_conversions = "n/a"; 53 } 54 55 if ($affiliate_sales['total'] > 0) { 56 $affiliate_average = $affiliate_sales['total'] / $affiliate_sales['count']; 57 } else { 58 $affiliate_average = 0; 59 } 60 ?> 61 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> 62 <html <?php echo HTML_PARAMS; ?>> 63 <head> 64 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 65 <title><?php echo TITLE; ?></title> 66 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> 67 <script language="javascript" src="includes/general.js"></script> 68 <script language="javascript"><!-- 69 function popupWindow(url) { 70 window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=450,height=120,screenX=150,screenY=150,top=150,left=150') 71 } 72 //--></script> 73 </head> 74 <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF"> 75 <!-- header //--> 76 <?php require (DIR_WS_INCLUDES . 'header.php'); ?> 77 <!-- header_eof //--> 78 79 <!-- body //--> 80 <table border="0" width="100%" cellspacing="2" cellpadding="2"> 81 <tr> 82 <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft"> 83 <!-- left_navigation //--> 84 <?php require (DIR_WS_INCLUDES . 'column_left.php'); ?> 85 <!-- left_navigation_eof //--> 86 </table></td> 87 <!-- body_text //--> 88 <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"> 89 <tr> 90 <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> 91 <tr> 92 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> 93 <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td> 94 <td class="pageHeading" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_AFFILIATE, tep_get_all_get_params(array('action'))) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td> 95 </tr> 96 </table></td> 97 </tr> 98 <tr> 99 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 100 <tr> 101 <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 102 <tr class="dataTableHeadingRow"> 103 <td class="dataTableHeadingContent"><?php echo TEXT_SUMMARY_TITLE; ?></td> 104 </tr> 105 </table></td> 106 </tr> 107 <tr> 108 <td><table width="100%" border="0" cellpadding="4" cellspacing="2" class="dataTableContent"> 109 <center> 110 <tr> 111 <td width="35%" align="right" class="dataTableContent"><b><?php echo TEXT_AFFILIATE_NAME; ?></b> </td> 112 <td width="15%" class="dataTableContent"><?php echo $affiliate['affiliate_firstname'] . ' ' . $affiliate['affiliate_lastname']; ?></td> 113 <td width="35%" align="right" class="dataTableContent"><?php echo TEXT_AFFILIATE_JOINDATE; ?> </td> 114 <td width="15%" class="dataTableContent"><?php echo tep_date_short($affiliate['affiliate_date_account_created']); ?></td> 115 </tr> 116 <tr> 117 <td width="35%" align="right" class="dataTableContent"><?php echo TEXT_IMPRESSIONS; ?><?php echo '<a href="javascript:popupWindow(\'' . (HTTP_SERVER . DIR_WS_CATALOG . FILENAME_AFFILIATE_HELP_1) . '\')">' . TEXT_SUMMARY_HELP . '</a>'; ?></td> 118 <td width="15%" class="dataTableContent"><?php echo $affiliate_impressions; ?></td> 119 <td width="35%" align="right" class="dataTableContent"><?php echo TEXT_VISITS; ?><?php echo '<a href="javascript:popupWindow(\'' . (HTTP_SERVER . DIR_WS_CATALOG . FILENAME_AFFILIATE_HELP_2) . '\')">' . TEXT_SUMMARY_HELP . '</a>'; ?></td> 120 <td width="15%" class="dataTableContent"><?php echo $affiliate_clickthroughs; ?></td> 121 </tr> 122 <tr> 123 <td width="35%" align="right" class="dataTableContent"><?php echo TEXT_TRANSACTIONS; ?><?php echo '<a href="javascript:popupWindow(\'' . (HTTP_SERVER . DIR_WS_CATALOG . FILENAME_AFFILIATE_HELP_3) . '\')">' . TEXT_SUMMARY_HELP . '</a>'; ?></td> 124 <td width="15%" class="dataTableContent"><?php echo $affiliate_sales['count']; ?></td> 125 <td width="35%" align="right" class="dataTableContent"><?php echo TEXT_CONVERSION; ?><?php echo '<a href="javascript:popupWindow(\'' . (HTTP_SERVER . DIR_WS_CATALOG . FILENAME_AFFILIATE_HELP_4) . '\')">' . TEXT_SUMMARY_HELP . '</a>'; ?></td> 126 <td width="15%" class="dataTableContent"><?php echo $affiliate_conversions.' %';?></td> 127 </tr> 128 <tr> 129 <td width="35%" align="right" class="dataTableContent"><?php echo TEXT_AMOUNT; ?><?php echo '<a href="javascript:popupWindow(\'' . (HTTP_SERVER . DIR_WS_CATALOG . FILENAME_AFFILIATE_HELP_5) . '\')">' . TEXT_SUMMARY_HELP . '</a>'; ?></td> 130 <td width="15%" class="dataTableContent"><?php echo $currencies->display_price($affiliate_sales['total'], ''); ?></td> 131 <td width="35%" align="right" class="dataTableContent"><?php echo TEXT_AVERAGE; ?><?php echo '<a href="javascript:popupWindow(\'' . (HTTP_SERVER . DIR_WS_CATALOG . FILENAME_AFFILIATE_HELP_6) . '\')">' . TEXT_SUMMARY_HELP . '</a>'; ?></td> 132 <td width="15%" class="dataTableContent"><?php echo $currencies->display_price($affiliate_average, ''); ?></td> 133 </tr> 134 <tr> 135 <td width="35%" align="right" class="dataTableContent"><?php echo TEXT_COMMISSION_RATE; ?><?php echo '<a href="javascript:popupWindow(\'' . (HTTP_SERVER . DIR_WS_CATALOG . FILENAME_AFFILIATE_HELP_7) . '\')">' . TEXT_SUMMARY_HELP . '</a>'; ?></td> 136 <td width="15%" class="dataTableContent"><?php echo $affiliate_percent, ' %'; ?></td> 137 <td width="35%" align="right" class="dataTableContent"><b><?php echo TEXT_COMMISSION; ?><?php echo '<a href="javascript:popupWindow(\'' . (HTTP_SERVER . DIR_WS_CATALOG . FILENAME_AFFILIATE_HELP_8) . '\')">' . TEXT_SUMMARY_HELP . '</a>'; ?></b></td> 138 <td width="15%" class="dataTableContent"><b><?php echo $currencies->display_price($affiliate_sales['payment'], ''); ?></b></td> 139 </tr> 140 <tr> 141 <td colspan="4"><?php echo tep_draw_separator(); ?></td> 142 </tr> 143 <tr> 144 <td align="center" class="dataTableContent" colspan="4"><b><?php echo TEXT_SUMMARY; ?></b></td> 145 </tr> 146 <tr> 147 <td colspan="4"><?php echo tep_draw_separator(); ?></td> 148 </tr> 149 <tr> 150 <td align="right" class="dataTableContent" colspan="4"><?php echo '<a href="' . tep_href_link(FILENAME_AFFILIATE_CLICKS, 'acID=' . $HTTP_GET_VARS['acID']) . '">' . tep_image_button('button_affiliate_clickthroughs.gif', IMAGE_CLICKTHROUGHS) . '</a> <a href="' . tep_href_link(FILENAME_AFFILIATE_SALES, 'acID=' . $HTTP_GET_VARS['acID']) . '">' . tep_image_button('button_affiliate_sales.gif', IMAGE_SALES) . '</a>'; ?></td> 151 </tr> 152 </center> 153 </table></td> 154 </tr> 155 </table></td> 156 </tr> 157 </table></td> 158 <!-- body_text_eof //--> 159 </tr> 160 </table> 161 <!-- body_eof //--> 162 163 <!-- footer //--> 164 <?php require (DIR_WS_INCLUDES . 'footer.php'); ?> 165 <!-- footer_eof //--> 166 <br> 167 </body> 168 </html> 169 <?php require (DIR_WS_INCLUDES . 'application_bottom.php');?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Jan 1 13:43:16 2010 | Cross-referenced by PHPXref 0.7 |