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,398

Results 1 to 20 of 464
5 Mar 2013, 5:24 PM
#1
lat9 avatar

lat9

Administrator

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

Snap Affiliates v2.0 for v1.5.0 and later

I'll be submitting this plugin to the Plugins area shortly, based on the similar-named plugin for the v1.3.x series (http://www.zen-cart.com/showthread.php?124461-snap-affiliates). This version (v2.0.0) will run only on Zen Cart v1.5.0 and later and includes the following additional changes:

  • No core-file overwrites!
  • Moved all language-specific text to the language file, both catalog and admin.
  • Moved $_SESSION['referrer'] initialization to /includes/init_includes/init_snap.php and /includes/auto_loaders/config.snap.php; /includes/application_top.php is no longer changed by this plugin.
  • Moved changes to /includes/database_tables.php and /includes/filenames.php to /includes/extra_datafiles/snap_file_database_names.php; those core files are no longer changed by this plugin.
  • Moved order-related commission updates to observer-class code; /includes/classes/order.php is no longer changed by this plugin.
  • Moved hard-coded referral terms to a separate language define file (/includes/languages/english/html_includes/define_referrer_terms.php and /includes/languages/english/html_includes/YOUR_TEMPLATE/define_referrer_terms.php).
  • Moved /snapconfigure.php file initializations to your admin's Configuration->Affiliate Program.
  • Database initialization is now performed automatically via your Zen Cart admin.
  • Added "Information" sidebox link, controlled via admin configuration switch.
  • Affiliate banner images are now specified via your admin.
  • Commissions are given only to affiliate accounts that are previously authorized and not banned. An affiliate customer can no longer get a discount by using their own affiliate code.
  • Using Zen Cart default email template for all emails sent; no longer require additional templates.
    Once I have the download location, I'll post it back here; it's kind of a chicken/egg thing between the plugin's download link and it's support-thread!
5 Mar 2013, 6:08 PM
#2
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

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

Oh Cindy you absolute star! Thank you very much. I didn't expect you to do it so soon, were you bored? :wink:

5 Mar 2013, 6:17 PM
#3
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

picandnix:

Oh Cindy you absolute star! Thank you very much. I didn't expect you to do it so soon, were you bored? :wink:
Only a bit:smile:

5 Mar 2013, 9:47 PM
#4
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

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

Ok...
installed on LOCAL copy of store
loaded just fine thank you, but, when going to admin>customers>referrers I don't have an option to enroll customer into affiliate program

Attachment 12058

and I'm getting error log as follows

[05-Mar-2013 21:38:58] PHP Warning: Invalid argument supplied for foreach() in C:\wamp\www\MYSTORE\MYADMIN\referrers.php on line 687

[05-Mar-2013 21:38:58] PHP Stack trace:

[05-Mar-2013 21:38:58] PHP 1. {main}() C:\wamp\www\MYSTORE\MYADMIN\referrers.php:0

5 Mar 2013, 9:59 PM
#5
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

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

Sorry timed out to edit post.
error log is line 514 not 687...

[05-Mar-2013 21:56:30] PHP Warning: Invalid argument supplied for foreach() in C:\wamp\www\MYSITE\MYADMIN\referrers.php on line 514

[05-Mar-2013 21:56:30] PHP Stack trace:

[05-Mar-2013 21:56:30] PHP 1. {main}() C:\wamp\www\MYSITE\MYADMIN\referrers.php:0

Thank you again Lat9 :hug:

6 Mar 2013, 1:52 PM
#6
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

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

picandnix:

Ok...
installed on LOCAL copy of store
loaded just fine thank you, but, when going to admin>customers>referrers I don't have an option to enroll customer into affiliate program

Attachment 12058

Doh! It's the referrers job to APPLY for an affiliate account rather than the admin to award an account isn't it, sorry my mistake.

6 Mar 2013, 1:55 PM
#7
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

picandnix:

Sorry timed out to edit post.
error log is line 514 not 687...

[05-Mar-2013 21:56:30] PHP Warning: Invalid argument supplied for foreach() in C:\wamp\www\MYSITE\MYADMIN\referrers.php on line 514

[05-Mar-2013 21:56:30] PHP Stack trace:

[05-Mar-2013 21:56:30] PHP 1. {main}() C:\wamp\www\MYSITE\MYADMIN\referrers.php:0

Thank you again Lat9 :hug:
This one makes more sense (there's no line 687 in the file). There is no provision in the plugin for an administrator to add a referrer; a referrer creates a customer account and signs up themselves. The administrator's job is to approve, ban or pay the referrer.

That said, the "Details" button shouldn't be shown if there are no referrers, so if you make the following change to line 358 of /YOUR_ADMIN/referrers.php that problem (and the subsequent error logs) will be corrected:

       <tr><td class="infoBoxContent"><br /><?php echo ($referrercount > 0) ? ('<a href="' . zen_href_link(FILENAME_REFERRERS, 'referrer=' . $referrers[$selected]['customers_id'] . '&mode=details', 'NONSSL') . '">' . zen_image_button('button_details.gif', IMAGE_DETAILS) . '</a>') : ' '; /*v2.0.1c*/ ?></td></tr>
6 Mar 2013, 1:56 PM
#8
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

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

A possible bug?
once the commission is marked as 'paid' by store admin the affiliate receives an email stating the commission earnings. However in my live test site the email received states my affiliate has received $0.00 even though admin shows that they have been paid $1.00.

6 Mar 2013, 1:59 PM
#9
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

lat9:

... Once I have the download location, I'll post it back here ...
It should be in the Plugins area shortly (http://www.zen-cart.com/downloads.php?do=file&id=1635) and you can always download it from my website.

6 Mar 2013, 3:00 PM
#10
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

picandnix:

A possible bug?
once the commission is marked as 'paid' by store admin the affiliate receives an email stating the commission earnings. However in my live test site the email received states my affiliate has received $0.00 even though admin shows that they have been paid $1.00.
An absolute bug, darn it! Make this change, starting at line 208 of /YOUR_ADMIN/referrers.php:

    
  case 'pay':
    $query = "UPDATE " . TABLE_COMMISSION . " SET commission_paid = NOW() WHERE commission_paid = '0000-00-00 00:00:00' AND commission_referrer_key = '" . $referrers[$selected]['referrer_key'] . "'";
    $result = $db->Execute($query);

    $now = date("Y-m-d H:i:s", time());
    $commission_paid = $referrers[$selected]['orders_unpaid']; /*v2.0.1a*/
    $referrers[$selected]['orders_unpaid'] = 0;

    for ($i = 0, $n = count($referrers[$selected]['orders']); $i < $n; $i++) {
      if ($referrers[$selected]['orders'][$i]['commission_paid'] == '0000-00-00 00:00:00') {
        $referrers[$selected]['orders'][$i]['commission_paid'] = $now;
      }
    }

    send_notification_email (
      $referrers[$selected], 
      EMAIL_SUBJECT_PAID,
      sprintf(EMAIL_MESSAGE_PAID_TEXT, $currencies->format(floatval($commission_paid)), zen_catalog_href_link(FILENAME_LOGIN, '', 'SSL'), zen_catalog_href_link(FILENAME_REFERRER_MAIN, '', 'SSL'), zen_catalog_href_link(FILENAME_CONTACT_US, '', 'NONSSL')),
      sprintf(EMAIL_MESSAGE_PAID_HTML, $currencies->format(floatval($commission_paid)), zen_catalog_href_link(FILENAME_LOGIN, '', 'SSL'), zen_catalog_href_link(FILENAME_REFERRER_MAIN, '', 'SSL'), zen_catalog_href_link(FILENAME_CONTACT_US, '', 'NONSSL'))); /*v2.0.1c*/

    break;

But wait ... there's more! :( Update /YOUR_ADMIN/extra_datafiles/referrers_filenames.php:

<?php
/*
** Database tables and filenames associated with the Snap Affiliates v2.0 plugin.
**
** NOTE:  Admin-side definitions!
*/
define('TABLE_REFERRERS', DB_PREFIX . 'referrers');
define('TABLE_COMMISSION', DB_PREFIX . 'commission');

define('FILENAME_REFERRERS', 'referrers');
define('FILENAME_REFERRER_MAIN', 'referrer_main');  /*v2.0.1a*/

and make the following change starting at line 82 of /YOUR_ADMIN/languages/english/referrers.php:

define('EMAIL_MESSAGE_PAID_HTML', 'A commission payment was recently made for your ' . STORE_NAME . ' referral account. Your total earnings this period were <strong>%1$s</strong>.<br /><br />To view your complete order history, you can login (<a href="%2$s">%2$s</a>) and view your referrer statistics (<a href="%3$s">%3$s</a>). If you have any questions, don\'t hesitate to contact us: <a href="%4$s">%4$s</a>.<br /><br />Sincerely,<br /><br />' . STORE_OWNER); /*v2.0.1c*/
define('EMAIL_MESSAGE_PAID_TEXT', 'A commission payment was recently made for your ' . STORE_NAME . ' referral account. Your total earnings this period were %1$s.' . "\n\n" . 'To view your complete order history, you can login (%2$s) and view your referrer statistics (%3$s).  If you have any questions, don\'t hesitate to contact us using this link: %4$s.' . "\n\nSincerely,\n\n" . STORE_OWNER); /*v2.0.1c*/
7 Mar 2013, 1:34 PM
#11
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

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

Working perfectly now :hug:

10 Mar 2013, 2:10 PM
#12
mikebr avatar

mikebr

Zen Follower

Join Date:
May 2007
Posts:
124
Plugin Contributions:
0

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

Installed Module.
Seems to be working.
What are the standard instructions to the affiliate for payment options?

10 Mar 2013, 2:23 PM
#13
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

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

you have to pay them manually by your preferred method, i.e PayPal or cheque.

10 Mar 2013, 4:39 PM
#14
mikebr avatar

mikebr

Zen Follower

Join Date:
May 2007
Posts:
124
Plugin Contributions:
0

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

Thanks for the quick reply.
When going to the Affiliate Tools web page under Marketing Tools, the first link includes "www.mysite.com/&referrer=CodedNo..." however when selecting that link it results in a "Page Not Found" at Mysite.com?

10 Mar 2013, 4:54 PM
#15
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

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

I can't replicate that error, are you logged in as a 'customer'?

10 Mar 2013, 5:20 PM
#16
mikebr avatar

mikebr

Zen Follower

Join Date:
May 2007
Posts:
124
Plugin Contributions:
0

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

I'm logged in as a customer. At the tab "Marketing Tools" It says ```html
"Site Link

The following link can be used anywhere you want to promote this site. Copy and paste the HTML code following each image into your blog or web page to link to us."

That link includes the customer's affiliate ID  or the link states <a href="http://www.mysite.com/&referrer=CodedNo...">Gifts for all occasions....</a>

That link ends up at "Page Not Found"
10 Mar 2013, 5:40 PM
#17
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

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

Do you have any other domains that you can add your own test link on? To link back to your store, to test how the mod works fully?

10 Mar 2013, 5:52 PM
#18
mikebr avatar

mikebr

Zen Follower

Join Date:
May 2007
Posts:
124
Plugin Contributions:
0

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

Don't have any other domains right now.
The question is when a customer puts the link image of my site on there web site, when that link is selected what web page on my site is it navigating to?

10 Mar 2013, 6:05 PM
#19
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

In your admin's Configuration->Affiliate Program, what do you have "Affiliate Key Prefix" set to?

10 Mar 2013, 6:07 PM
#20
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

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

mikebr:

Don't have any other domains right now.
The question is when a customer puts the link image of my site on there web site, when that link is selected what web page on my site is it navigating to?

using the default option links to homepage but you Vann also select a specific product too by using the tool in the box.