Forums / All Other Contributions/Addons / Snap Affiliates v2.0 for v1.5.0 and later

Snap Affiliates v2.0 for v1.5.0 and later

Views: 68,410

Results 241 to 260 of 464
26 Sep 2014, 2:21 PM
#241
semide avatar

semide

New Zenner

Join Date:
Aug 2009
Location:
Waltham, Massachusetts, United States
Posts:
22
Plugin Contributions:
0

Snap Affiliates v2.0 for v1.5.0 and later

Hello all, quick question for anyone who knows: How are affiliate codes in Snap Affiliates generated? We are putting a site together with about 450 existing affiliates, and would like to maintain the original affiliate codes for legacy users. Our codes have a common prefix, so that should work. Can I just replace the affiliate code in the database for each legacy user, and allow the system to generate new codes for new users? Our old codes are fairly simple, and by their construction should not create any collisions.

Thanks in advance for any insight.

26 Sep 2014, 6:16 PM
#242
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: Snap Affiliates v2.0 for v1.5.0 and later

The referrer "key" (aka affiliate code) is calculated as:

      $tag = SNAP_KEY_PREFIX . $_SESSION['customer_id'] . time();

So, the keys are calculated as the prefix you choose followed by a sequence of numerical digits.

7 Oct 2014, 9:55 PM
#243
semide avatar

semide

New Zenner

Join Date:
Aug 2009
Location:
Waltham, Massachusetts, United States
Posts:
22
Plugin Contributions:
0

Re: Snap Affiliates v2.0 for v1.5.0 and later

Thank you for the very prompt answer. It looks like I will be able to use my old codes.

I have a new issue. If I check the box to include the "Our Affiliate Program" page in the sidebox, it puts the link both first and last in the box. Any idea why it may be duplicated?

8 Oct 2014, 12:06 PM
#244
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: Snap Affiliates v2.0 for v1.5.0 and later

semide:

Thank you for the very prompt answer. It looks like I will be able to use my old codes.

I have a new issue. If I check the box to include the "Our Affiliate Program" page in the sidebox, it puts the link both first and last in the box. Any idea why it may be duplicated?
Check the file /includes/modules/sideboxes/YOUR_TEMPLATE/information.php. The file that is part of the plugin's distribution includes the "Our Affiliate Program" link as the first entry only.

8 Oct 2014, 3:38 PM
#245
mvstudio avatar

mvstudio

Zen Follower

Join Date:
Apr 2008
Posts:
447
Plugin Contributions:
1

Re: Snap Affiliates v2.0 for v1.5.0 and later

Just installed the mod, and I'm having some issues with it.

quick question, I need to display the actual commission paid amount on the clients account area, is there a way to show it?
Thanks.

M.Valenti
Contemporary Artist - Entrepreneur
http://www.manuelavalenti.com - http://www.byvalenti.com

8 Oct 2014, 3:56 PM
#246
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: Snap Affiliates v2.0 for v1.5.0 and later

The "referrers_main" page will show any commissions paid to the affiliate-customer.

8 Oct 2014, 4:03 PM
#247
mvstudio avatar

mvstudio

Zen Follower

Join Date:
Apr 2008
Posts:
447
Plugin Contributions:
1

Re: Snap Affiliates v2.0 for v1.5.0 and later

Thanks Lat9.
It currently shows only the commission based on the total amount of the order, not the actual commission paid amount.
In the admin area of the store, we can input the amount that will be paid to the affiliate on a particular order, say for example the order total is $80, the commission to be paid on a 10% is $8, but we had a return on that order, so the actual commission goes down to $5. On the referrers_main page the $5 isn't shown, only the $8.

M.Valenti
Contemporary Artist - Entrepreneur
http://www.manuelavalenti.com - http://www.byvalenti.com

8 Oct 2014, 4:07 PM
#248
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: Snap Affiliates v2.0 for v1.5.0 and later

I appreciate the detailed report, I'll look into the issue and report back.

8 Oct 2014, 4:54 PM
#250
mvstudio avatar

mvstudio

Zen Follower

Join Date:
Apr 2008
Posts:
447
Plugin Contributions:
1

Re: Snap Affiliates v2.0 for v1.5.0 and later

I think I was able to make it work for what we need, and it might be helpful for someone else, so here it goes.

We wanted to show both the commission based on the order's amount, and the actual commission paid, which is stored on the database as commission_paid_amount. So we added an extra column that displays the commission_paid_amount.

All the changes made show as //EWD so they're easy to locate.
modules>pages>referrer_main>header_php.php

<?php
// +----------------------------------------------------------------------+
// |Snap Affiliates for Zen Cart                                          |
// +----------------------------------------------------------------------+
// | Copyright (c) 2013, Vinos de Frutas Tropicales (lat9) for ZC 1.5.0+  |
// |                                                                      |
// | Original: Copyright (c) 2009 Michael Burke                           |
// | http://www.filterswept.com                                           |
// |                                                                      |
// | This source file is subject to version 2.0 of the GPL license.       |
// +----------------------------------------------------------------------+

require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));

$breadcrumb->add(NAVBAR_TITLE);

$today = getdate();

$referrer = null;
$submitted = false;
$approved = false;
$banned = false;
$is_referrer = false;
$is_logged_in = isset ($_SESSION['customer_id']);

$total_total = 0;
$total_commission = 0;
$unpaid_total = 0;
$unpaid_commission = 0;
$yearly_total = 0;
$yearly_commission = 0;
$last_payout = 0;
$next_payout = 0;

$activity_begin = mktime(0, 0, 0, $today['mon'], 1, $today['year']);
$activity_end = mktime(23, 59, 59, $activity_begin['mon'] + 1, 0, $today['year']);
$activity_total = 0;
$activity_commission = 0;
$activity_total_commission_paid_amount = 0; //EWD 
$activity_commission_paid_amount = 0; // EWD
$activity = array();

if (isset($_GET['start'])) {
  $activity_begin = intval ($_GET['start']);
}

if( $activity_begin > time() ) {
  $activity_begin = time();
}

if (isset ($_GET['end'])) {
  $activity_end = intval( $_GET['end'] );
}

if ($activity_begin > $activity_end) {
  $tempDate = getdate ($activity_begin);

  $activity_end = mktime (23, 59, 59, $tempDate['mon']+1, 0, $tempDate['year']);
}

if (!$is_logged_in) {
  zen_redirect(zen_href_link(FILENAME_REFERRER_SIGNUP, '', "SSL"));
  
} else {
  $query = "SELECT * FROM ". TABLE_REFERRERS ." WHERE referrer_customers_id = " . (int)$_SESSION['customer_id'];
  $referrer = $db->Execute($query);

  if (!is_object($referrer) || $referrer->EOF ) {
    zen_redirect(zen_href_link(FILENAME_REFERRER_SIGNUP, '', "SSL"));
    
  } else {
    $submitted = true;
    $approved = (bool)$referrer->fields['referrer_approved'];
    $banned = (bool)$referrer->fields['referrer_banned'];

    if ($approved) {
      if (!defined('SNAP_ORDER_STATUS_EXCLUSIONS')) define('SNAP_ORDER_STATUS_EXCLUSIONS', ''); /*v2.1.0a*/     
      if (!defined('SNAP_ORDER_TOTALS_EXCLUSIONS')) define('SNAP_ORDER_TOTALS_EXCLUSIONS', 'ot_tax,ot_shipping');

//-bof-v2.1.0c (changed $exclude_array to $totals_exclude_array
      $totals_exclude_array = explode(',', SNAP_ORDER_TOTALS_EXCLUSIONS);
      
      for ($i = 0, $totals_exclude_clause = '', $n = count($totals_exclude_array); $i < $n; $i++) {
        if ($i != 0) {
          $totals_exclude_clause .= ' OR ';
        }
        $totals_exclude_clause .= ("t.class = '" . $totals_exclude_array[$i] . "'");
      }
      if ($totals_exclude_clause != '') {
        $totals_exclude_clause = " AND ( $totals_exclude_clause ) ";
      }
//-eof-v2.1.0c

      $year_start = mktime(0,0,0, 1, 1, $today['year']);

//-bof-v2.1.0a: Don't show commission for orders status values in the "exclude list".
      $status_exclude_array = explode(',', SNAP_ORDER_STATUS_EXCLUSIONS);
//-eof-v2.1.0a

      $no_status_exclusions = (sizeof($status_exclude_array) == 1 && $status_exclude_array[0] == '') ? true : false;  /*v2.5.1a*/
      
// EWD Added c.commission_paid_amount
      $query = "SELECT o.orders_id, o.date_purchased, o.order_total, c.commission_paid, c.commission_paid_amount, c.commission_rate, o.orders_status
	                FROM ". TABLE_ORDERS ." o, " . TABLE_COMMISSION . " c 
                  WHERE c.commission_referrer_key = '" . $referrer->fields['referrer_key'] . "' 
                    AND o.orders_id = c.commission_orders_id"; /*v2.1.0c*/

      $orders = $db->Execute($query);      
 
      while (!$orders->EOF) {
        $commission = floatval($orders->fields['commission_rate']);
        $purchase_date = strtotime($orders->fields['date_purchased']);
        $current_date = $orders->fields['commission_paid'];
        $current_commission_paid_amount = floatval($orders->fields['commission_paid_amount']); // EWD
        
        $query = "SELECT t.value 
                    FROM " . TABLE_ORDERS ." o, ". TABLE_ORDERS_TOTAL ." t
                    WHERE o.orders_id = " . $orders->fields['orders_id'] . " 
                      AND o.orders_id = t.orders_id" . $totals_exclude_clause; /*v2.1.0c*/
        $totals = $db->Execute($query);
        $current_exclusion = 0;
        while (!$totals->EOF) {
          $current_exclusion += floatval($totals->fields['value']);
          
          $totals->MoveNext();
        }

        $current_amount = floatval($orders->fields['order_total']) - $current_exclusion;

        if ($current_amount < 0) {
          $current_amount = 0;
        }

        if ($current_date != "0000-00-00 00:00:00") {
          $current_date = strtotime($current_date);
        } else {
          $current_date = 0;
        }
        
        if ( $no_status_exclusions || !($current_date == 0 && in_array($orders->fields['orders_status'], $status_exclude_array)) ) {  /*v2.5.0a,v2.5.1c*/
          $total_total += $current_amount;
          $total_commission += $commission * $current_amount;

          if( $purchase_date > $year_start ) {
            $yearly_total += $current_amount;
            $yearly_commission += $commission * $current_amount;
          }
          
          if ($current_date === 0) {
            $unpaid_total += $current_amount;
            $unpaid_commission += $commission * $current_amount;
          }
          
          if ($current_date > $last_payout) {
            $last_payout = $current_date;
          }

          if ($activity_begin < $current_date && $current_date < $activity_end) {  /*v2.5.0c*/
            $activity_total += $current_amount;
            $activity_commission += $commission * $current_amount;
            $activity_total_commission_paid_amount += $current_commission_paid_amount; // EWD
            $activity_commission_paid_amount += $current_commission_paid_amount; // EWD

// EWD added 'commission_paid_amount' => $current_commission_paid_amount to the array
            array_push( $activity, array('amount' => $current_amount, 'date' => $purchase_date, 'paid' => $current_date, 'commission' => $commission, 'commission_paid_amount' => $current_commission_paid_amount) );
          }
          
        }  /*v2.5.0a*/

        $orders->MoveNext();
      }
    }
  }
}

templates>YOUR TEMPLATES>templates>tpl_referrer_main_default.php
All changes on this file show as <!-- EWD -->.

<?php
// +----------------------------------------------------------------------+
// |Snap Affiliates for Zen Cart                                          |
// +----------------------------------------------------------------------+
// | Copyright (c) 2013, Vinos de Frutas Tropicales (lat9) for ZC 1.5.0+  |
// |                                                                      |
// | Original: Copyright (c) 2009 Michael Burke                           |
// | http://www.filterswept.com                                           |
// |                                                                      |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license.       |
// +----------------------------------------------------------------------+
?>
<div class="centerColumn" id="referrerMainDefault">
<?php
if ($messageStack->size('referrer_main') > 0) echo $messageStack->output('referrer_main');  /*v2.4.0-a*/

if (!$is_logged_in) {
?>
  <p id="refMainNeedLogin"><?php echo sprintf(TEXT_PLEASE_LOGIN, zen_href_link(FILENAME_LOGIN, '', 'SSL')); ?></p>
  
<?php
} else {
  if (!$submitted) {
?>
  <p id="refMainNotSubmitted"><?php echo sprintf(TEXT_REFERRER_SIGNUP, zen_href_link(FILENAME_REFERRER_SIGNUP, '', 'SSL')); ?></p>
  
<?php
  } else {
    if (!$approved) {
?>
  <p><?php echo TEXT_REFERRAL_SUBMITTED; ?></p>
<?php
    } else {
      if ($banned) {    
?>
  <p><?php echo sprintf(TEXT_REFERRAL_BANNED, zen_href_link(FILENAME_CONTACT_US, '', 'NONSSL')); ?></p>
<?php
      } else {
        echo zen_draw_form('referral_main', zen_href_link(FILENAME_REFERRER_MAIN, '', 'SSL'), 'get', ''); /*v2.4.0-c*/
?>
  <input type="hidden" name="main_page" value="<?php echo FILENAME_REFERRER_MAIN; ?>" />
  <div id="refSignupLinks"><?php echo TEXT_ORDERS_PAYMENTS; ?> | <a href="<?php echo zen_href_link(FILENAME_REFERRER_TOOLS, '', 'SSL');?>"><?php echo TEXT_MARKETING_TOOLS; ?></a> | <a href="<?php echo zen_href_link(FILENAME_REFERRER_SIGNUP, 'terms', 'SSL');?>"><?php echo TEXT_REFERRER_TERMS; ?></a></div>

  <hr />
  <h3><?php echo HEADING_REFERRER_INFO; ?></h3>
  <div id="referrerMainInfo" class="table">
    <div class="item_outer">
      <div class="item c1"><?php echo TEXT_REFERRER_ID; ?></div>
      <div class="item c2"><?php echo $referrer->fields['referrer_key']; ?></div>
    </div>
<?php //-bof-v2.2.0a ?>
    <div class="item_outer">
      <div class="item c1"><?php echo TEXT_MY_WEBSITE; ?></div>
      <div class="item c2"><?php echo $referrer->fields['referrer_homepage'] . '<a href="' . /*-bof-c-v2.4.0*/ zen_href_link(FILENAME_REFERRER_EDIT, '', 'SSL') /*-eof-c-v2.4.0*/ . '">  ' . zen_image_button(BUTTON_IMAGE_EDIT_SMALL, BUTTON_EDIT_SMALL_ALT) . '</a>';; ?></div>
    </div>
<?php //-eof-v2.2.0a ?>
    <div class="item_outer">
      <div class="item c1"><?php echo TEXT_LAST_PAYMENT_MADE; ?></div>
      <div class="item c2"><?php echo ($last_payout == 0) ? TEXT_NO_PAYMENTS : date("F j, Y", $last_payout); /*v2.5.0c*/ ?></div>
    </div>
    <div class="item_outer">
      <div class="item c1"><?php echo TEXT_COMMISSION_RATE; ?></div>
      <div class="item c2"><?php printf("%u%%", 100 * $referrer->fields['referrer_commission']); ?></div>
    </div>
  </div>
  <br />
  <hr />
  
  <h3><?php echo TEXT_SALES_SUMMARY; ?></h3>
  <div id="referrerMainSummary" class="table">
    <div class="item_outer">
      <div class="item c1"><?php echo TEXT_CURRENT_SALES; ?></div>
      <div class="item c2"><?php echo $currencies->format($unpaid_total); ?></div>
    </div>
    <div class="item_outer">
      <div class="item c1"><?php echo TEXT_UNPAID_COMMISSION; ?></div>
      <div class="item c2"><?php echo $currencies->format($unpaid_commission, 2); ?></div>
    </div>
    <div class="item_outer">
      <div class="item c1"><?php echo TEXT_YTD_SALES; ?></div>
      <div class="item c2"><?php echo $currencies->format($yearly_total, 2); ?></div>
    </div>
    <div class="item_outer">
      <div class="item c1"><?php echo TEXT_YTD_COMMISSION; ?></div>
      <div class="item c2"><?php echo $currencies->format($yearly_commission, 2); ?></div>
   </div>
  </div>
  <br />
  <hr />

  <h3 class="back"><?php echo TEXT_ACTIVITY; ?></h3>
  <div class="forward" style="margin-top: 12px;">

    <?php echo TEXT_FROM; ?>
    <input type="hidden" name="start" value="<?php echo $activity_begin; ?>" />
    <select onchange="document.referral_main.start.value = this.options[this.selectedIndex].value; document.referral_main.submit();">
<?php
  $begin = getdate($activity_begin);
  $end = getdate($activity_end);

  $today = getdate();
  $bound = ( $begin['year'] == $today['year'] ) ? $today['mon'] : 12;

  for( $i = 1; $i <= $bound; ++$i ) {
    printf('<option value="%u"%s>%s</option>' . "\n", mktime(0, 0, 0, $i, 1, $begin['year']), ($i == $begin['mon']) ? ' selected="selected"' : '', date ('F', mktime(0,0,0, $i)));
  }
?>
    </select>
    <select onchange="document.referral_main.start.value = this.options[this.selectedIndex].value; document.referral_main.submit();">
<?php
  for ($i = $today['year'] - 9; $i <= $today['year']; $i++) {
    printf('<option value="%u"%s>%s</option>' ."\n", mktime(0, 0, 0, $begin['mon'], 1, $i), (($i == $begin['year']) ? ' selected="selected"' : ''), date( "Y", mktime(0,0,0, $begin['mon'], 1, $i)));
  }
?> 
    </select>
    <?php echo TEXT_TO; ?>
    <input type="hidden" name="end" value="<?php echo $activity_end; ?>" />
    <select onchange="document.referral_main.end.value = this.options[this.selectedIndex].value; document.referral_main.submit();">
  <?php
  $bound = ( $end['year'] == $today['year'] ) ? $today['mon'] : 12;

  for( $i = 1; $i <= $bound; ++$i ) {
    printf('<option value="%u"%s>%s</option>' . "\n", mktime(0, 0, 0, $i + 1, 0, $end['year']), (($i == $end['mon']) ? ' selected="selected"' : ''), date('F', mktime(0,0,0, $i)));
  }
  ?>
    </select>
    <select onchange="document.referral_main.end.value = this.options[this.selectedIndex].value; document.referral_main.submit();">
  <?php
  for( $i = $begin['year']; $i <= $today['year']; ++$i) {
    printf('<option value="%u"%s>%s</option>' . "\n", mktime(0, 0, 0, $end['mon'] + 1, 0, $i), (($i == $end['year'] ) ? ' selected="selected"' : ''), date('Y', mktime(0,0,0, $end['mon'] + 1, 0, $i)));
  }
  ?>
    </select>
  </div>
  <br class="clearBoth" />

  <div id="referrerMainHistory" class="table">
    <div class="head_outer">
      <div class="thead c1"><?php echo HEADING_PURCHASE_DATE; ?></div>
      <div class="thead c2"><?php echo HEADING_AMOUNT; ?></div>
      <div class="thead c1"><?php echo HEADING_COMMISSION_RATE; ?></div>
      <div class="thead c2"><?php echo HEADING_AMOUNT; ?></div>
<!-- BOF EWD -->
      <div class="thead c2"><?php echo HEADING_COMMISSION; ?></div>
<!-- EOF EWD -->
      <div class="thead c1"><?php echo HEADING_COMMISSION_PAY_DATE; ?></div>
    </div>

<?php
  $toggle = false;  

  foreach ($activity as $entry) {
    $nice_date = ($entry['paid'] == 0) ? TEXT_UNPAID : date('F j, Y', $entry['paid']);  /*v2.5.0c*/
?>
    <div class="item_outer <?php echo ($toggle) ? 'odd' : 'even'; ?>">
      <div class="item c1a"><?php echo date('F j, Y', $entry['date']); ?></div>
      <div class="item c2"><?php echo $currencies->format($entry['amount']); ?></div>
      <div class="item c3"><?php echo number_format($entry['commission'] * 100, 0) . '%'; ?></div>
      <div class="item c4"><?php echo $currencies->format($entry['commission'] * $entry['amount']); ?></div>
<!-- BOF EWD -->
      <div class="item c4"><?php echo $currencies->format($entry['commission_paid_amount']); ?></div>
<!-- EOF EWD -->
      <div class="item c5"><?php echo $nice_date; ?></div>
    </div>   
<?php
    $toggle = !$toggle;
  }
?>
    <div class="item_outer totals">
      <div class="item c1"><?php echo HEADING_TOTALS; ?></div>
      <div class="item c2"><?php echo $currencies->format($activity_total); ?></div>
      <div class="item c3"><?php echo ' '; ?></div>
      <div class="item c4"><?php echo $currencies->format($activity_commission); ?></div>
<!-- BOF EWD -->
      <div class="item c4"><?php echo $currencies->format($activity_commission_paid_amount); ?></div>
<!-- EOF EWD -->
      <div class="item c5"><?php echo ' '; ?></div>
    </div>
  </div>
  </form>
<?php
      }  // Signed in, submitted, approved and not banned
    }  // Signed in, submitted but not approved
    
    if (!$approved || $banned) {
?>
  <div class="buttonRow back"><?php echo zen_back_link() . zen_image_button(BUTTON_IMAGE_BACK, BUTTON_BACK_ALT) . '</a>'; ?></div>
<?php
    }
  }  // Signed in but not submitted 
}  // Signed in
?>
</div>

There are no changes on the language file, just used HEADING_COMMISSION which was already on the file.

Hope this helps someone else.

And thanks Lat9 for the quick reply! =)

M.Valenti
Contemporary Artist - Entrepreneur
http://www.manuelavalenti.com - http://www.byvalenti.com

8 Oct 2014, 5:02 PM
#251
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: Snap Affiliates v2.0 for v1.5.0 and later

Ouch, that's not very pretty! My current plan for this display issue is, for any commissions that were manually-overridden, to display a (*) next to the commission amount and include a note below the commissions-paid table that reads:

(*) This commission value was modified by the store owner based on a change to the order.

Any suggestions/improvements would be greatly appreciated!

** Update **
Perhaps the right solution is a combination of mvstudio's posting (showing both calculated and paid) along with a notation when they're different to let the customer know that the store knows that they're different?

8 Oct 2014, 6:38 PM
#252
mvstudio avatar

mvstudio

Zen Follower

Join Date:
Apr 2008
Posts:
447
Plugin Contributions:
1

Re: Snap Affiliates v2.0 for v1.5.0 and later

Ouch, that's not very pretty! LOL! oookkkk!!!! :huh:

What we did was add the coding that was needed to display the extra column using the original files provided, nothing more. My apologies for asking the how to, without taking a look at the files first. I thought it could solve the problem for somebody else, looking for the same thing, so that's why I shared. Any extras or styling is up to the store owner, I think. We didn't like the original layout of the page, so ours was customized to match our stores, and we took all those divisions out and replaced them for tables instead. We also added a note to the page that explains the reason for any discrepancy in commissions as established in our Terms, which is what you were referring to.

This is what ours tpl_referrer_main_default.php page looks like

For anyone looking to style the page like ours here is the code for the tpl_referrer_main_default.php

<?php
// +----------------------------------------------------------------------+
// |Snap Affiliates for Zen Cart                                          |
// +----------------------------------------------------------------------+
// | Copyright (c) 2013, Vinos de Frutas Tropicales (lat9) for ZC 1.5.0+  |
// |                                                                      |
// | Original: Copyright (c) 2009 Michael Burke                           |
// | http://www.filterswept.com                                           |
// |                                                                      |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license.       |
// +----------------------------------------------------------------------+
?>
<div class="centerColumn" id="referrerMainDefault">
<h1 id="affiliateMain"><?php echo HEADING_TITLE; ?></h1>
<?php
if ($messageStack->size('referrer_main') > 0) echo $messageStack->output('referrer_main');  /*v2.4.0-a*/

if (!$is_logged_in) {
?>
  <p id="refMainNeedLogin"><?php echo sprintf(TEXT_PLEASE_LOGIN, zen_href_link(FILENAME_LOGIN, '', 'SSL')); ?></p>
  
<?php
} else {
  if (!$submitted) {
?>
  <p id="refMainNotSubmitted"><?php echo sprintf(TEXT_REFERRER_SIGNUP, zen_href_link(FILENAME_REFERRER_SIGNUP, '', 'SSL')); ?></p>
  
<?php
  } else {
    if (!$approved) {
?>
  <p><?php echo TEXT_REFERRAL_SUBMITTED; ?></p>
<?php
    } else {
      if ($banned) {    
?>
  <p><?php echo sprintf(TEXT_REFERRAL_BANNED, zen_href_link(FILENAME_CONTACT_US, '', 'NONSSL')); ?></p>
<?php
      } else {
        echo zen_draw_form('referral_main', zen_href_link(FILENAME_REFERRER_MAIN, '', 'SSL'), 'get', ''); /*v2.4.0-c*/
?>
  <input type="hidden" name="main_page" value="<?php echo FILENAME_REFERRER_MAIN; ?>" />
  <div id="refSignupLinks">
  	<h3><?php echo TEXT_ORDERS_PAYMENTS; ?> | <a href="<?php echo zen_href_link(FILENAME_REFERRER_TOOLS, '', 'SSL');?>"><?php echo TEXT_MARKETING_TOOLS; ?></a> | <a href="<?php echo zen_href_link(FILENAME_REFERRER_SIGNUP, 'terms', 'SSL');?>"><?php echo TEXT_REFERRER_TERMS; ?></a></h3>
  </div>

  <hr />
  <h3><?php echo HEADING_REFERRER_INFO; ?></h3>
  <div id="referrerMainInfo" class="table">
    <div class="item_outer">
      <div class="item c1"><?php echo TEXT_REFERRER_ID; ?></div>
      <div class="item c2"><?php echo $referrer->fields['referrer_key']; ?></div>
    </div>
<?php //-bof-v2.2.0a ?>
    <div class="item_outer">
      <div class="item c1"><?php echo TEXT_MY_WEBSITE; ?></div>
      <div class="item c2"><?php echo $referrer->fields['referrer_homepage'] . '<br /><a href="' . /*-bof-c-v2.4.0*/ zen_href_link(FILENAME_REFERRER_EDIT, '', 'SSL') /*-eof-c-v2.4.0*/ . '">' . zen_image_button(BUTTON_IMAGE_EDIT_SMALL, BUTTON_EDIT_SMALL_ALT) . '</a>  '; ?></div>
    </div>
<?php //-eof-v2.2.0a ?>
    <div class="item_outer">
      <div class="item c1"><?php echo TEXT_LAST_PAYMENT_MADE; ?></div>
      <div class="item c2"><?php echo ($last_payout == 0) ? TEXT_NO_PAYMENTS : date("F j, Y", $last_payout); /*v2.5.0c*/ ?></div>
    </div>
    <div class="item_outer">
      <div class="item c1"><?php echo TEXT_COMMISSION_RATE; ?></div>
      <div class="item c2"><?php printf("%u%%", 100 * $referrer->fields['referrer_commission']); ?></div>
    </div>
  </div>
  <br />
  <hr />
  
  <h3><?php echo TEXT_SALES_SUMMARY; ?></h3>
  <div id="referrerMainSummary" class="table">
    <div class="item_outer">
      <div class="item c1"><?php echo TEXT_CURRENT_SALES; ?></div>
      <div class="item c2"><?php echo $currencies->format($unpaid_total); ?></div>
    </div>
    <div class="item_outer">
      <div class="item c1"><?php echo TEXT_UNPAID_COMMISSION; ?></div>
      <div class="item c2"><?php echo $currencies->format($unpaid_commission, 2); ?></div>
    </div>
    <div class="item_outer">
      <div class="item c1"><?php echo TEXT_YTD_SALES; ?></div>
      <div class="item c2"><?php echo $currencies->format($yearly_total, 2); ?></div>
    </div>
    <div class="item_outer">
      <div class="item c1"><?php echo TEXT_YTD_COMMISSION; ?></div>
      <div class="item c2"><?php echo $currencies->format($yearly_commission, 2); ?></div>
   </div>
  </div>
  <br />
  <hr />

  <h3 class="back"><?php echo TEXT_ACTIVITY; ?></h3>
  <div class="forward" style="margin-top: 12px;">

    <?php echo TEXT_FROM; ?>
    <input type="hidden" name="start" value="<?php echo $activity_begin; ?>" />
    <select onchange="document.referral_main.start.value = this.options[this.selectedIndex].value; document.referral_main.submit();">
<?php
  $begin = getdate($activity_begin);
  $end = getdate($activity_end);

  $today = getdate();
  $bound = ( $begin['year'] == $today['year'] ) ? $today['mon'] : 12;

  for( $i = 1; $i <= $bound; ++$i ) {
    printf('<option value="%u"%s>%s</option>' . "\n", mktime(0, 0, 0, $i, 1, $begin['year']), ($i == $begin['mon']) ? ' selected="selected"' : '', date ('F', mktime(0,0,0, $i)));
  }
?>
    </select>
    <select onchange="document.referral_main.start.value = this.options[this.selectedIndex].value; document.referral_main.submit();">
<?php
  for ($i = $today['year'] - 9; $i <= $today['year']; $i++) {
    printf('<option value="%u"%s>%s</option>' ."\n", mktime(0, 0, 0, $begin['mon'], 1, $i), (($i == $begin['year']) ? ' selected="selected"' : ''), date( "Y", mktime(0,0,0, $begin['mon'], 1, $i)));
  }
?> 
    </select>
    <?php echo TEXT_TO; ?>
    <input type="hidden" name="end" value="<?php echo $activity_end; ?>" />
    <select onchange="document.referral_main.end.value = this.options[this.selectedIndex].value; document.referral_main.submit();">
  <?php
  $bound = ( $end['year'] == $today['year'] ) ? $today['mon'] : 12;

  for( $i = 1; $i <= $bound; ++$i ) {
    printf('<option value="%u"%s>%s</option>' . "\n", mktime(0, 0, 0, $i + 1, 0, $end['year']), (($i == $end['mon']) ? ' selected="selected"' : ''), date('F', mktime(0,0,0, $i)));
  }
  ?>
    </select>
    <select onchange="document.referral_main.end.value = this.options[this.selectedIndex].value; document.referral_main.submit();">
  <?php
  for( $i = $begin['year']; $i <= $today['year']; ++$i) {
    printf('<option value="%u"%s>%s</option>' . "\n", mktime(0, 0, 0, $end['mon'] + 1, 0, $i), (($i == $end['year'] ) ? ' selected="selected"' : ''), date('Y', mktime(0,0,0, $end['mon'] + 1, 0, $i)));
  }
  ?>
    </select>
  </div>
  <br class="clearBoth" />
  <br class="clearBoth" />

  <table style="width: 100%">
	<tr>
		<td class="thead c1" style="width:16.6%;"><?php echo HEADING_PURCHASE_DATE; ?></td>
		<td class="thead c1" style="width:16.6%;"><?php echo HEADING_AMOUNT; ?></td>
		<td class="thead c1" style="width:16.6%;"><?php echo HEADING_COMMISSION_RATE; ?></td>
		<td class="thead c1" style="width:16.6%;"><?php echo HEADING_AMOUNT_COMMISSION; ?></td>
		<td class="thead c1" style="width:16.6%;"><?php echo HEADING_COMMISSION; ?></td>
		<td class="thead c1" style="width:16.7%;"><?php echo HEADING_COMMISSION_PAY_DATE; ?></td>
	</tr>

<?php
  $toggle = false;  

  foreach ($activity as $entry) {
    $nice_date = ($entry['paid'] == 0) ? TEXT_UNPAID : date('F j, Y', $entry['paid']);  /*v2.5.0c*/
?>
	<tr class="item_outer <?php echo ($toggle) ? 'odd' : 'even'; ?>">
		<td class="item c1a"><?php echo date('F j, Y', $entry['date']); ?></td>
		<td class="item c2"><?php echo $currencies->format($entry['amount']); ?></td>
		<td class="item c3"><?php echo number_format($entry['commission'] * 100, 0) . '%'; ?></td>
		<td class="item c4"><?php echo $currencies->format($entry['commission'] * $entry['amount']); ?></td>
		<td class="item c4"><?php echo $currencies->format($entry['commission_paid_amount']); ?></td>
		<td class="item c5"><?php echo $nice_date; ?></td>
	</tr>

<?php
    $toggle = !$toggle;
  }
?>

	<tr class="item_outer totals">
		<td class="item c1"><?php echo HEADING_TOTALS; ?></td>
		<td class="item c2"><?php echo $currencies->format($activity_total); ?></td>
		<td class="item c3"><?php echo ' '; ?></td>
		<td class="item c4"><?php echo $currencies->format($activity_commission); ?></td>
		<td class="item c4"><?php echo $currencies->format($activity_commission_paid_amount); ?></td>
		<td class="item c5"><?php echo ' '; ?></td>
	</tr>
</table>
  </form>

  <br class="clearBoth" />

<p><?php echo TEXT_COMMISSION_PAID; ?></p>
  <br class="clearBoth" />

  <div class="buttonRow back"><?php echo zen_back_link() . zen_image_button(BUTTON_IMAGE_BACK, BUTTON_BACK_ALT) . '</a>'; ?></div>
  <br class="clearBoth" />
  
<?php
      }  // Signed in, submitted, approved and not banned
    }  // Signed in, submitted but not approved
    
    if (!$approved || $banned) {
?>
  <div class="buttonRow back"><?php echo zen_back_link() . zen_image_button(BUTTON_IMAGE_BACK, BUTTON_BACK_ALT) . '</a>'; ?></div>
<?php
    }
  }  // Signed in but not submitted 
}  // Signed in
?>
</div>

On the language>english>YOUR TEMPLATE>referrer_main.php:
Replace:

define('HEADING_COMMISSION', 'Commission');

For:

define('HEADING_COMMISSION', '*Commission Total');

And Add:

define('TEXT_COMMISSION_PAID', '<strong>*Commission Total</strong> amounts, include any refunds or returns that have being deducted from the final commission amount. For more information on how
commissions are calculated please visit our <a href="index.php?main_page=referrer_signup&terms">Affiliate Terms & Conditions".');

Hope this is a little bit better =)

M.Valenti
Contemporary Artist - Entrepreneur
http://www.manuelavalenti.com - http://www.byvalenti.com

8 Oct 2014, 7:19 PM
#253
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: Snap Affiliates v2.0 for v1.5.0 and later

My ouch! was on the plugin's current output, not your suggested changes!:shocking:

I'll incorporate your changes into the next version of SNAP ... thanks for the share.

8 Oct 2014, 8:24 PM
#254
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: Snap Affiliates v2.0 for v1.5.0 and later

I've submitted v2.7.2 to the Plugins; it will be available for download one reviewed:

BUGFIX: Previously missing /images/referrers directory now included
BUGFIX: Correct processing on referrers_main page (make a distinction between calculated and paid commissions).

Thanks (again) to mvstudio for the report and the suggested correction!

12 Oct 2014, 7:07 PM
#256
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: Snap Affiliates v2.0 for v1.5.0 and later

v2.7.2 is now available for download in the Plugins ...

13 Oct 2014, 5:05 PM
#257
georgiepants avatar

georgiepants

New Zenner

Join Date:
Jan 2010
Posts:
36
Plugin Contributions:
0

Re: Snap Affiliates v2.0 for v1.5.0 and later

Great Plug-in. I'm trying to add multiple banners in the same size but different color variations. I'm not sure how I should name them. I have one of each size uploaded and working, however I want to add a blue version, magenta version, etc of the same size. I tried naming them "ref.160.600.blue.png" and entered 160,600,blue,png/ in Admin... but its not working.

Any help or suggestions appreciated.

13 Oct 2014, 5:42 PM
#258
georgiepants avatar

georgiepants

New Zenner

Join Date:
Jan 2010
Posts:
36
Plugin Contributions:
0

Re: Snap Affiliates v2.0 for v1.5.0 and later

Also, where can I enter the image alt text???

13 Oct 2014, 5:57 PM
#259
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: Snap Affiliates v2.0 for v1.5.0 and later

georgiepants:

Great Plug-in. I'm trying to add multiple banners in the same size but different color variations. I'm not sure how I should name them. I have one of each size uploaded and working, however I want to add a blue version, magenta version, etc of the same size. I tried naming them "ref.160.600.blue.png" and entered 160,600,blue,png/ in Admin... but its not working.

Any help or suggestions appreciated.
The plugin doesn't currently support multiple images of the same size. That feature is on its "wishlist".

13 Oct 2014, 6:01 PM
#260
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: Snap Affiliates v2.0 for v1.5.0 and later

georgiepants:

Also, where can I enter the image alt text???
There is currently no provision to enter an individual image's custom alt-text, but the common text currently used is the TEXT_IMAGE_ALT_TEXT constant defined in /includes/languages/english/YOUR_TEMPLATE/referrers_tools.php.