Page 1 of 1
Limiting Affiliate Orders
Posted: Fri Feb 19, 2010 9:37 am
by michael.p.larsen
Hello,
I want to only associate an order with an affiliate once. What I mean is this... person X comes to mysite.com/SomeProduct.aspx?afid=1 and they order that product. That order should be associated with that affiliate. But now, if person X orders product Y in a totally NEW order, I do NOT want the affiliate to be associated with that order.
Does that make sense? How do I do this.
I know you can limit the time in DAYS, but it would be handy to set a limit like I mentioned above, or set a limit in MINUTES.
How can I go about doing this?
Thanks!
Re: Limiting Affiliate Orders
Posted: Fri Feb 19, 2010 12:11 pm
by mazhar
I guess you are looking for the ability of specifying the affiliate association for only one order for a customer. I believe this could be done with some code in OnePageCheckout. In my opinon CheckingOut event handler of OnePageCheckout would be a nice place to do this stuff. Edit Your ConLIb/OnePageCheckout.ascx.cs file and place this code just above the closing brace of its CheckingOut event handler.
Code: Select all
if (Token.Instance.User.AffiliateId > 0)
{
OrderCollection ordersWithAffiliate = OrderDataSource.LoadForCriteria(string.Format("UserId={0} AND AffiliateId={1}", Token.Instance.UserId, Token.Instance.User.AffiliateId));
if (ordersWithAffiliate.Count > 0)
{
//NOT A VALID AFFILIATE SO REMOVE IT
Token.Instance.User.AffiliateId = 0;
Token.Instance.User.Save();
}
}
Re: Limiting Affiliate Orders
Posted: Fri Feb 19, 2010 4:23 pm
by michael.p.larsen
NICE! Thanks Mazhar.
Re: Limiting Affiliate Orders
Posted: Fri Feb 19, 2010 5:47 pm
by michael.p.larsen
In the criteria, can I specify a time? If more than a day has passed, it's okay if the affiliate is associated with an order.
How do I do this?
Thanks for all your help Mazhar.
Re: Limiting Affiliate Orders
Posted: Fri Feb 19, 2010 5:54 pm
by michael.p.larsen
Actually even better -- on the ReceiptPage.ascx.cs, how can I remove all references to an affiliate?
Re: Limiting Affiliate Orders
Posted: Sat Feb 20, 2010 8:36 am
by jmestep
This might work- in Able 5 there was a setting where you could make an affiliate's orders persistent or not.
In the Able 7 admin, there is a field "Referral Days". If you set that to one, it might accomplish what you want, but I'm not sure.
Re: Limiting Affiliate Orders
Posted: Wed Feb 24, 2010 2:24 pm
by michael.p.larsen
Thanks for all the insight.
On the ReceiptPage control, in the Page_Init I added the following code:
Code: Select all
Token.Instance.User.AffiliateId = 0;
Token.Instance.User.Save();