Jump to content

Referral discount using GET value in URL


Bazze

Recommended Posts

Hello!

I need some help with creating a referral system based on customers ID. What I want is that every customer has a personal referral link (ex: http://www.myshop.com/?r=CUSTOMER_ID) which they can send to there friends. People shopping thru that link will receive a discount, as will also the referrer. The referral program module isn't exactly doin' it that way, but that is how I want it!

Any tips on how to do this?

Link to comment
Share on other sites

Okay, I've found the built-in "affiliate" system under Admin > Stats > Referrers. I'm now trying to do so every customer that registers will be registered as an affiliate too. But I get a strange error messge the way I'm trying to do it.

/* INSERT CUSTOMER AS AN AFFILIATE */
$affiliate = new Referrer();
$affiliate->id_customer = $customer->id;

$rand = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$code_len = 8;
$rand_need = $code_len - strlen((String)$customer->id);

$code = (String)$customer->id . 'R';
while (strlen($code) < $code_len) {
   $r = rand(1, strlen($rand)-1);
   $code .= substr($rand, $r, 1);
}

$affiliate->name = $customer->email;
$affiliate->http_referer_like = 'ref=' . $code;
$affiliate->percent_fee = 5.00;

$affiliate->add(true);



I get this error message when creating an account:

Hack attempt (Employee -> lastname is empty)


I understand nothing... What does the Employee class has to do with the Referrers? Any ideas how to solve this?

Thanks!
Link to comment
Share on other sites

  • 2 weeks later...

Could you do this? Im so interested.

I need a store with discounts coupons, specials and affiliate system that works :S I've tried some stores like x-cart ioncube zencart and more, now i will give a chance to prestashop and oscommerce, maybe I can find a solution here.

Link to comment
Share on other sites

  • 4 months later...
  • 7 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...