[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/ -> affiliate_summary.php (source)

   1  <?php
   2  /*

   3  $Id: affiliate_summary.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  // Most of this file is changed or moved to BTS - Basic Template System - format.

  18  // For adding in contribution or modification - parts of this file has been moved to: catalog\templates\fallback\contents\<filename>.tpl.php as a default (sub 'fallback' with your current template to see if there is a template specife change).

  19  //       catalog\templates\fallback\contents\<filename>.tpl.php as a default (sub 'fallback' with your current template to see if there is a template specife change).

  20  // (Sub 'fallback' with your current template to see if there is a template specific file.)

  21  
  22    require ('includes/application_top.php');
  23  
  24    if (!tep_session_is_registered('affiliate_id')) {
  25      $navigation->set_snapshot();
  26      tep_redirect(tep_href_link(FILENAME_AFFILIATE, '', 'SSL'));
  27    }
  28  
  29    require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_AFFILIATE_SUMMARY);
  30  
  31    $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_AFFILIATE_SUMMARY));
  32  
  33    $affiliate_banner_history_raw = "select sum(affiliate_banners_shown) as count from " . TABLE_AFFILIATE_BANNERS_HISTORY .  " where affiliate_banners_affiliate_id  = '" . $affiliate_id . "'";
  34    $affiliate_banner_history_query=tep_db_query($affiliate_banner_history_raw);
  35    $affiliate_banner_history = tep_db_fetch_array($affiliate_banner_history_query);
  36    $affiliate_impressions = $affiliate_banner_history['count'];
  37    if ($affiliate_impressions == 0) $affiliate_impressions="n/a"; 
  38  
  39    $affiliate_clickthroughs_raw = "select count(*) as count from " . TABLE_AFFILIATE_CLICKTHROUGHS . " where affiliate_id = '" . $affiliate_id . "'";
  40    $affiliate_clickthroughs_query = tep_db_query($affiliate_clickthroughs_raw);
  41    $affiliate_clickthroughs = tep_db_fetch_array($affiliate_clickthroughs_query);
  42    $affiliate_clickthroughs =$affiliate_clickthroughs['count'];
  43  
  44    $affiliate_sales_raw = "
  45              select count(*) as count, sum(affiliate_value) as total, sum(affiliate_payment) as payment from " . TABLE_AFFILIATE_SALES . " a 
  46              left join " . TABLE_ORDERS . " o on (a.affiliate_orders_id=o.orders_id) 
  47              where a.affiliate_id = '" . $affiliate_id . "' and o.orders_status >= " . AFFILIATE_PAYMENT_ORDER_MIN_STATUS . " 
  48              ";
  49    $affiliate_sales_query = tep_db_query($affiliate_sales_raw);
  50    $affiliate_sales = tep_db_fetch_array($affiliate_sales_query);
  51  
  52    $affiliate_transactions=$affiliate_sales['count'];
  53    if ($affiliate_clickthroughs > 0) {
  54      $affiliate_conversions = tep_round(($affiliate_transactions / $affiliate_clickthroughs)*100, 2) . "%";
  55    } else {
  56      $affiliate_conversions = "n/a";
  57    }
  58    $affiliate_amount = $affiliate_sales['total'];
  59    if ($affiliate_transactions>0) {
  60      $affiliate_average = tep_round($affiliate_amount / $affiliate_transactions, 2);
  61    } else {
  62      $affiliate_average = "n/a";
  63    }
  64    $affiliate_commission = $affiliate_sales['payment'];
  65  
  66    $affiliate_values = tep_db_query("select * from " . TABLE_AFFILIATE . " where affiliate_id = '" . $affiliate_id . "'");
  67    $affiliate = tep_db_fetch_array($affiliate_values);
  68    $affiliate_percent = 0;
  69    $affiliate_percent = $affiliate['affiliate_commission_percent'];
  70    if ($affiliate_percent < AFFILIATE_PERCENT) $affiliate_percent = AFFILIATE_PERCENT;
  71  
  72    $content = affiliate_summary; 
  73  
  74    include (bts_select('main', $content_template)); // BTSv1.5

  75  
  76    require (DIR_WS_INCLUDES . 'application_bottom.php'); 
  77  ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7