I want to set up individual commission percentages for individual users.
I go to a users page and under the Commissions field I see this:
The commission percentage for this user (number only). Leave blank to use either product or global commissions.
This indicates to me that the number that I type in will result in a percentage commission that will be credited to the user.
This is not what happens though.
Setting the value here to "15" results in a commission of $0.15 not 15% of the product price.
This does override the commission set @ http://mysite.com/admin/store/affiliate/commissions which is good, but it does not calculate it as a percentage.
I checked the issues queue and it looks like no one has identified this as an issue before.
So it makes me think that I am missing something.
What am I doing wrong?
Comment | File | Size | Author |
---|---|---|---|
#9 | uc_affiliate2-898882.patch | 3.61 KB | darktygur-1 |
Comments
Comment #1
darktygur-1 CreditAttribution: darktygur-1 commentedThe problem is with _uc_affiliate2_get_commission(). It used to return a "Commission percentate as a value between 0 and 1" (the documentation for that function needs to be updated). Since #715728: Fixed commissions (commit #342360), it now returns either just a number for fixed commissions, or a number with a percent sign for percentage commissions. It looks like nobody noticed the piece in the function that takes the user's commission amount into consideration:
I would've made a patch, but I ran out of time. If nobody does it in the meantime, I'll make one next week. I would fix it by updating the description for that user field to say that a fixed commission or a percentage with percent sign may be entered. Then _uc_affiliate2_get_commission() will be able to return the user's commission with no changes, if it finds a value (and that function's documention should be updated). I'd also add an update hook to the .install file to add percent signs to user commissions that may already be present.
I think that would take care of it.
Comment #2
dadderley CreditAttribution: dadderley commented@darktygur
Thanks for your reply.
I will take a look at the code on Monday morning and see what I can do.
Comment #3
Dokuro CreditAttribution: Dokuro commentedDid anyone ever get a patch for this?
Comment #4
dadderley CreditAttribution: dadderley commentedA patch would be nice.
Comment #5
Dokuro CreditAttribution: Dokuro commentedI agree.... ;-)
Comment #6
Dokuro CreditAttribution: Dokuro commentedSo, a quick fix for this, sure this isn't the best solution, but it does what I want it to do.
Change : return $account->commission / 100;
To: return $account->commission. '%';
I am sure we will be putting more love into this module as soon as my CTO has his kid and things settle down for him.
Again, thanks for the great module!
Comment #7
dadderley CreditAttribution: dadderley commentedThis worked perfectly on my test site.
Now my client will be happy.
Thanks
Comment #8
Dokuro CreditAttribution: Dokuro commentedI wouldn't mark this as fixed though, as it seems like nothing is really working based on roles through all the settings.
Comment #9
darktygur-1 CreditAttribution: darktygur-1 commentedWhat does this particular option have to do with roles?
In any case, my patch is attached. While I was at it, I added some code to validate the commission field.
Comment #10
univate CreditAttribution: univate commentedThis patch looks good to me and makes sense, will test it properly though.
Comment #11
bojanz CreditAttribution: bojanz commentedCommitted. Can't be worse than the current code, and the change does make sense.
Thanks, darktygur.