Affiliate v2

Contrib type: 
Module
Status: 
Uploaded for testing
Moderation: 
Not ready for moderation
Latest version: 
v2

Downloads


Compatibility: 
Ubercart 1.x

This module was adapted by Bojan Živanović (email: bojanz@gmail.com) @ http://vividintent.com from the original Affiliate module by jhuckabee.

Originally multiple people wanted to pool together and sponsor this module. No one followed through unfortunately so if you'd like to support continuation of this module and add features, please email bojan and then continue this increasingly important module.

This new and improved affiliate module has the following features:

Granular tracking
-User based tracking
-Role based tracking

Ability to create affiliate links:
-both text and image
-Export to CSV or HTML
-Product level link generation (e.g. generate a link for the actual product vs just the website)

Cookie option
-have the ability to add cookies so that affiliates get credit for return visits even though they didn't go through original affiliate link
-Option to set amount of time (e.g. 3 months)

Dashboard
-Easy customer dashboard (with div's so they're themable)

and more!

Hope you enjoy.

Aaron Schiff
Ecopaper.com

VERSION 01
-Fixes bug that gives commission on whole sale as opposed to one product


giorgio79@drupal.org's picture
Offline
Joined: 02/02/2008
Juice: 280
Re: Affiliate v2

Thanks Aron, fantastic stuff! Will be checking it out soon!

Cheers,
G

ClipGlobe - World Travel

srpromo's picture
Offline
Joined: 08/18/2008
Juice: 19
Just so everyone knows

this module is a tough time with very little documentation.

bwv
bwv's picture
Offline
Uber DonorBug FinderEarly adopter... addicted to alphas.Spreading the word - Ubercart for president.
Joined: 08/07/2007
Juice: 430
Re: Just so everyone knows

Easy as pie! Thanks Aron.

zach's picture
Offline
Joined: 08/13/2008
Juice: 9
features

does this module have all the same features of the old one. specifically the sub-domain thing. other than the new features you added of course.

tgeller's picture
Offline
Joined: 09/21/2008
Juice: 8
Reporting a typo?

Hey, folks. I was referred here by Ryan and am just checking out the module here for the first time. I'm really excited about it!

I noticed a small typo -- user/%/affiliate has the text "Links to Ecopaper" when it should be something like "Links to this site". Sorry, I'd submit it as a patch, but don't know how to do that (or whether this is the best place to report it -- I didn't see an issues queue).

Cheers,

--Tom Geller

cwhitcoe's picture
Offline
Joined: 07/28/2008
Juice: 8
Is this compatible with Drupal 6.x

I am using Drupal 6.x and am really looking forward to using this. is this possible?

mimetic2's picture
Offline
Joined: 08/07/2007
Juice: 478
Re: features

We changed subdomain to having domain.com/affiliate, however the functionality is still there and can be done with some tweaking.

jgross's picture
Offline
Joined: 08/25/2008
Juice: 11
Really interested in module..

I'm curious what the "Moderation:
Failed code review" means?

zach's picture
Offline
Joined: 08/13/2008
Juice: 9
issue with the math

i just upgraded to this version of the affiliate module. first i ran into an error when trying to run a test order through. it had to do with an extra debug line "dsm($product);" from what i understand that only has to do with debuging.

i also changed the language where it said "Links to Ecopaper" i changed it to "Links to Copy" i'm not sure what really should be there, thats just what i put.

now i ran into another problem...

i figured out that the commission is only paid for quantity 1 of each item. if someone buys 3 of an item. the affiliate only gets paid the commission on the price of 1. i don't really know php at all so i don't know how to fix the problem. could someone point me in the right direction?

also where it displays the commission info in user/%/affiliate/commissions it shows the total price after shipping. i think that the commission should be paid on the total before shipping, so it shouldn't show the final total b/c it makes it confusing to the affiliate.

If anyone could help me out on this it would be greatly appreciated.

mimetic2's picture
Offline
Joined: 08/07/2007
Juice: 478
Hi Zach, I'm looking into

Hi Zach,

I'm looking into the problem where commission is only paid for the first item.

As for the total price after shipping, that would cost money. If you guys want to help support this module, please feel free to donate via paypal and i can pass this off to my developer who can get this done asap.

https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=238311

stephthegeek's picture
Offline
Theminator
Joined: 10/20/2007
Juice: 575
Basing commission on # of products sold

We're looking at starting an affiliate program where X number of products sold gets a free product for the affiliate. At its simplest, we just need to have it so people can sign up and get an affiliate code, grab links/banners, and then be able to keep track of their sales so we can manually give them a discount coupon when they sell X products.

So it sounds like there would need to be some kind of feature added to have the affiliate program optionally based on # of products sold rather than amount of sale. If you're accepting bounties for features like this, can you let me know what kind of donation you'd be looking for?

Gorgeous original Drupal themes (and Ubercart themes!) ~ Psst: more Ubercart themes on our new site

jgross's picture
Offline
Joined: 08/25/2008
Juice: 11
Commission on all items

I had to edit uc_affiliate_order() in order to get it to work at all. For me, I didn't need the "Find all affiliates related to order" other than those that were upline as affiliates. I changed the function as follows, and is working for me:

<?php
function uc_affiliate_order($op, $order, $status) {
  global
$user;
  if (
$op == 'update' && $status == variable_get('affiliate_commission_order_status', 'completed')) {
   
$total = 0;
    foreach (
$order->products as $product) {
       
$product_total = $product->qty * $product->price;
        
$total = $total + $product_total;
    }
   
$affid = _uc_affiliate_get_user($user->uid);   
    if(
$affid != 0) {
       
// write commission records
       
$affs = _uc_affiliate_get_upline_ids($affid);

        for (

$i=0; $i<count($affs); $i++) {
           
$aff = $affs[$i];
           
$level = $i+1;
           
$comm_pct = _uc_affiliate_get_commission_percentage($level);           
            if (
$comm_pct>0) {
             
//TODO should this be rounded to nearest penny???
             
$comm = $total * $comm_pct;
             
$note = t('Level @level commission of @percent% recorded for affiliate @affiliate', array('@affiliate' => $aff, '@percent' => $comm_pct*100, '@level' => $level, '@commission' => uc_currency_format($comm), '@ordertotal' => uc_currency_format($total), '@firstname' => $order->billing_first_name, '@lastname' => $order->billing_last_name));
             
db_query("INSERT {uc_affiliate_commission} (order_id, aid, commission, commission_notes) VALUES (%d, %d, %f, '%s')", $order->order_id, $aff, $comm, $note);
             
uc_order_comment_save($order->order_id, $user->uid, $note);
             
uc_affiliate_add_count($aff, 0, 0, 1);
            }
        }
     }
  }
}
?>
mimetic2's picture
Offline
Joined: 08/07/2007
Juice: 478
Re: Commission on all items

new version should have this fixed.

jgross's picture
Offline
Joined: 08/25/2008
Juice: 11
Commission

The commission override inside the user profile page doesn't work. Probably a good thing though, as the user has the ability to edit their own commission level.

I've noticed several problems and have worked fixes for some of them. I'm under a deadline that doesn't allow me to code them in a way to be transferred here. I'm having to do it very specific to the installation I'm working on. After the deadline, I'll be more than happy to outline some of those and provide solutions. I'm kinda new to this site, is this post where I should put those? Or do I post them under a "support request"?

bojanz's picture
Offline
Joined: 08/07/2008
Juice: 15
Hi jgross, Feel free to post

Hi jgross,
Feel free to post any suggestions/code changes you might have here, or email me at bojanz@gmail.com.
I have been a bit tight on time myself, but plan to devote more time to the module, and create a home for it at drupal.org

Stay tuned.

Passer's picture
Offline
Joined: 10/16/2008
Juice: 25
Re: Hi jgross, Feel free to post

Does anyone know where the admin can set the Commision rate?
And why an Affiliate Actor can set under my account:
"Affiliate Commission Settings
Commission:

The commission percentage for this user (number only)."

I am a little bit confused

MfG
Passer

davegan@drupal.org's picture
Offline
Joined: 07/21/2008
Juice: 26
Bug fixes, improvements, and new commission by product feature

I've attached some work I've done on the module this afternoon.

There was a bug that allowed users to adjust their own commission percentages (yikes!). I've added a new permission 'adjust user commissions' to disallow that.

I cleaned up some misspellings and text. If affiliate depth is set to 1, now affiliates do not see "downline" and "upline" in their affiliate center.

In addition I've added a feature that allows you to set commission for each product. If it's set, it'll override the store wide commissions for that product. It can be set under a local tab on the product edit page. I've added a table to my database to hold this data, but I didn't have time to muck about with the module's install file, so you'll have to execute this yourself on your test DB:

CREATE TABLE IF NOT EXISTS `uc_affiliate_product_commission` (
  `nid` mediumint(9) NOT NULL,
  `commission_structure` longtext NOT NULL,
  PRIMARY KEY  (`nid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Hope some people can test these changes and let me know if there are any problems. I tested it in my use case (1 level of depth), but haven't tested every possible configuration.

AttachmentSize
uc_affiliate_02.zip 37.38 KB
bojanz's picture
Offline
Joined: 08/07/2008
Juice: 15
New version

I am attaching the new version of the module.
I've took davegan's version, added his extra table to the install code, fixed the uninstall code, and renamed the module to uc_affiliate2.
This will allow it to be submitted to drupal.org

You should uninstall the old module before you install this one, since it's technically a new module.
However, the tables haven't changed, so you can rename your old ones from uc_affiliate_* to uc_affiliate2_* or just reinsert the data, and nothing will be lost.

AttachmentSize
uc_affiliate2.zip 22.02 KB
bojanz's picture
Offline
Joined: 08/07/2008
Juice: 15
Drupal home

This module now has a home at:
http://drupal.org/project/uc_affiliate2

I am attaching the version listed as 1.0 there.
Compared to the previous archive, it has a bug fixed where the affiliate urls were wrong (affiliates/ instead of affiliate/)

AttachmentSize
uc_affiliate2.zip 22.06 KB
bojanz's picture
Offline
Joined: 08/07/2008
Juice: 15
1.1 released

Released v1.1 fixing an SQL Injection vulnerability.

Attaching it here.

AttachmentSize
uc_affiliate2.zip 22.19 KB
fulee's picture
Offline
Joined: 11/16/2008
Juice: 2
a little help :)

Hi all!

I'm so sorry, but I'm so lost with this modul, could someone give me a bit of help? How can I add new affiliates, and give them link so they can send the new customers to the site?
I saw the affiliate center button under my personal data, but when i click on for example, "click here for product links" i get a blank page Smiling I also found the affiliate modul under moduls, but I haven't seen anything like these things there either.

I tryed to find the answer elsewhere, couldnt Smiling

Thank you for your help,
Regards,
fulee

Berto's picture
Offline
Joined: 01/02/2009
Juice: 6
Re: 1.1 released

bojanz, you should get this new version up at http://drupal.org/project/uc_affiliate2

- Berto
-- Founder, PricePlow - http://www.PricePlow.com
--- Price Comparisons for Supplements, Vitamins, and diet products

Berto's picture
Offline
Joined: 01/02/2009
Juice: 6
Re: Is this compatible with Drupal 6.x

The latest version is not compatible with Drupal 6.x, but since Ubercart 2 for Drupal 6.x is now in beta, I'm going to start playing with this and see if I can get it working for Drupal 6. Has anyone else started working on that?

- Berto
-- Founder, PricePlow - http://www.PricePlow.com
--- Price Comparisons for Supplements, Vitamins, and diet products

jasonruyle's picture
Offline
Joined: 01/18/2008
Juice: 238
Re: Re: Is this compatible with Drupal 6.x

Has anyone completed this for Drupal 6.x?
I would be willing to work on this if someone has started this process. We can discuss what is left on fixing this for the upgrade.
If someone would prefer to do it all them self and needs motivation, I can provide some cash.

crumpeta's picture
Offline
Joined: 03/02/2009
Juice: 7
Partial Working Module for Drupal 6 and Ubercart 2

Hi all,
I've needed this module for a client whose store is on D6 and UC2. I've never used this module before so I don't really understand all of its intended behavior. I've gotten most of the module that I'm interested in working but I wanted to throw out what I have and see if people can tell me what the rest (the product affiliate portion) is supposed to do so I can fix the remainder. I don't intend this to be a patch for the official upgrade of this module to UC2, but I know that a lot of people are waiting for some working version of this module and I figure that something is better than nothing. Please let me know what you find broken!

thanks

-alan

AttachmentSize
uc_affiliate2.tar.gz 21.17 KB
giorgio79@drupal.org's picture
Offline
Joined: 02/02/2008
Juice: 280
Hi Alan, I think it is best

Hi Alan,

I think it is best if you post this as a patch at the project page:
http://drupal.org/project/uc_affiliate2

Review Critical
ClipGlobe - World Travel

coachstevetoth's picture
Offline
Joined: 08/28/2009
Juice: 17
Implementing Affiliate Program

Could someone tell me how do I manually change upline info. In the initial roll out I am creating all of the accounts not the user, so it indicates that there is no upline?

rashmi's picture
Offline
Joined: 12/06/2009
Juice: 2
good idea

I think this is a good idea and can be used to accrue commercial benefit to website owners, besides of course understanding visitor data.
Web Design and Development Dubai UAE

Bruiseviolet's picture
Offline
Joined: 10/22/2010
Juice: 232
Re: Affiliate v2

You need to go into your database and locate "drp_uc_affiliate2_users" you then go in (it can be a bit of a pain, because you need to look up affiliate and user id's)- but you can go in and change the UID/AID to 'move' the users to the correct uid as upline etc.. We had a similar problem, where it was remembering cookies and an admin had gone in and manually created a user account for a customer- and then this customer was getting all the admins commissions. lol Ooops.

Mom. Entrepreneur. Awesome. www.frequencyapps.com