Page 25 of 46 FirstFirst ... 15232425262735 ... LastLast
Results 241 to 250 of 460
  1. #241
    Join Date
    Aug 2009
    Location
    Waltham, Massachusetts, United States
    Posts
    22
    Plugin Contributions
    0

    Default Re: 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.

  2. #242
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,361
    Plugin Contributions
    94

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

    The referrer "key" (aka affiliate code) is calculated as:
    Code:
          $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.

  3. #243
    Join Date
    Aug 2009
    Location
    Waltham, Massachusetts, United States
    Posts
    22
    Plugin Contributions
    0

    Default 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?

  4. #244
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,361
    Plugin Contributions
    94

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

    Quote Originally Posted by semide View Post
    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.

  5. #245
    Join Date
    Apr 2008
    Posts
    446
    Plugin Contributions
    1

    Default 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.

  6. #246
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,361
    Plugin Contributions
    94

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

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

  7. #247
    Join Date
    Apr 2008
    Posts
    446
    Plugin Contributions
    1

    Default 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. #248
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,361
    Plugin Contributions
    94

    Default 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.

  9. #249
    Join Date
    Apr 2008
    Posts
    446
    Plugin Contributions
    1

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

    Thanks so much!
    M.Valenti
    Contemporary Artist - Entrepreneur
    http://www.manuelavalenti.com - http://www.byvalenti.com

  10. #250
    Join Date
    Apr 2008
    Posts
    446
    Plugin Contributions
    1

    Default 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 Code:
    <?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(000$today['mon'], 1$today['year']);
    $activity_end mktime(235959$activity_begin['mon'] + 10$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 (235959$tempDate['mon']+10$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,011$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) == && $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 == && 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 -->.
    HTML Code:
    <?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*/ . '">&nbsp;&nbsp;' . 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 '&nbsp;'; ?></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 '&nbsp;'; ?></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! =)
    Last edited by mvstudio; 8 Oct 2014 at 05:58 PM.
    M.Valenti
    Contemporary Artist - Entrepreneur
    http://www.manuelavalenti.com - http://www.byvalenti.com

 

 
Page 25 of 46 FirstFirst ... 15232425262735 ... LastLast

Similar Threads

  1. snap-affiliates?
    By JohnBoyCR in forum All Other Contributions/Addons
    Replies: 222
    Last Post: 16 Oct 2016, 08:10 PM
  2. v139h Seperate login for sales affiliates and distributors ?
    By respawnedelectronics in forum General Questions
    Replies: 4
    Last Post: 5 Jul 2014, 04:40 PM
  3. v151 snap affiliates bitcoins
    By unckle fester in forum All Other Contributions/Addons
    Replies: 6
    Last Post: 6 Jun 2014, 07:44 AM
  4. Snap Affiliates Module?
    By asauterChicago in forum All Other Contributions/Addons
    Replies: 3
    Last Post: 12 Apr 2013, 09:45 AM
  5. snap affiliates not emailing
    By mindcraft in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 9 Apr 2012, 11:19 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR