Hi,

I've managed to get subdomains working happily on my system (PHP 5.2.11, Nginx 8.33, Drupal Pressflow 6.15) using Domain Access.

However, when I enable the UC Affiliate 2 option to enable affiliate subdomain handling, it immediately creates a 302 redirect loop on any subdomain (i.e. anything other than www). There's also an error being spat out about 15-20 times on each page load of the www version:

"You are attempting to access an affiliate store that does not exist."

I really need to get UC Affiliate 2 working across all subdomains, so grateful if anybody can tell me what's causing this.

Thanks,

Matt

Comments

univate’s picture

Category: bug » support

You can't allow uc_affiliate2 to create subdomains if you are using subdomains for something else - that is certainly going to end in problems like you are seeing.

Mateo99999’s picture

Hi,

I didn't realise thats what it was - I thought it simply meant that affiliate clicks through existing subdomains wouldn't register unless this option is enabled.

I guess this means it'll be ok without enabling that option, then?

Thanks for your response.

Matt

univate’s picture

Status: Active » Fixed

One thing you may want to think about is affiliate are tracked via sessions and cookies, if these are shared across subdomains then affiliates will be tracked across subdomains as well. But if you have different session/cookies then a user that lands on one subdomain (via an affiliate link) will not be tracked if they purchase from a different subdomain.

dabblela’s picture

Is there any way to get this module working with something like the subdomain module? I'm trying to allow affiliates to create a profile page on affiliate.mysite.com and would like affiliates to be tracked just by visiting their profile pages.

I'm happy to sponsor a fix if it is possible.

univate’s picture

Read what I wrote in #3

dabblela’s picture

I'm not sure I follow, that doesn't seem any different from what happens now. If I go to mydomain.com/affiliate/3 and then go to mydomain.com/affiliate/4 and then go to check out, Affiliate 3 is still in my session.

However, I did manage to hack together (emphasis on hack) something that accomplishes setting the session for the first subdomain a user visits for my use case, if anyone is interested.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

darktygur-1’s picture

Category: support » bug
Status: Closed (fixed) » Active

I actually had the same symptoms while testing the code in uc_affiliate2_click(). The problem is that when an affiliate subdomain is present, the function views it as an affiliate click, and proceeds to log it and redirect the user. But it only redirects to a relative path, so after the redirect, the affiliate subdomain is still present. The function (which is called from a hook_init() implementation) notices that on the next page load, though I don't think it'll log another affiliate click, but it redirects the user again with the relative path, still preserving the subdomain, etc...

Is there any reason to redirect at all for subdomain links? I would expect people running these sites to prefer that the subdomain remain there for the duration of the user's visit, and that when people arrive via a link to a particular page, they stay there.

bojanz’s picture

The subdomain handling code is really old, from the very beginnings of the module.
Started as a way to say bojanz.drupal.org instead of drupal.org/affiliate/3 (and we switched to using uids for a reason, utf8 usernames wouldn't play well with the whole idea).

Frankly, I'm not sure how needed this functionality actually is.
It's certainly useless the way it is now, so what we need is a persuasive use case.
Otherwise, we should remove it...

univate’s picture

I like the idea for having support for affiliate subdomains, as its a feature you may want to provide to specific high earning affiliates, so I would like to see the feature remain. Maybe rather then attempting to support it for all usernames there is an option to enable it only on certain accounts.

But I can't say I have even attempted to use this feature myself - so not sure the exact state of it.

bojanz’s picture

Status: Active » Closed (fixed)

Removed subdomain support from the current version.
It was flawed and useless.

See Domain Access for the right way to do this.
See #787842: UC Affiliate 2 x Domain User; when a user's domain is hit, set affiliate data for sample integration with Domain Access.

A future task is to integrate similar code into uc_affiliate2.