Restricting affiliate option by access level

  • Posts: 4
  • Thank you received: 0
12 years 10 months ago #43682

Hi, I know from reading previous threads that it is not possible to suppress certain elements of the client account menu, however, I wonder if it is possible to restrict the display to certain access levels?

My client would like to offer the affiliate programme only to a specific clients who have a custom access level, but not to registered users. I tried restricted the access level on the affiliate plugin, however, this stops it from tracking altogether.

Is there a way of hard coding this into the view for the client account menu?

Please Log in or Create an account to join the conversation.

  • Posts: 83103
  • Thank you received: 13418
  • MODERATOR
12 years 10 months ago #43803

Hi,

The simplest would be to duplicate that plugin. Remove the onUserAccountDisplay function definition from the copy plugin file.
Then, restrict the access level of the original plugin and don't restrict the access level of the copy.

That way, it should still track the users while displaying that button only for the people allowed.

Please Log in or Create an account to join the conversation.

  • Posts: 4
  • Thank you received: 0
12 years 10 months ago #43815

Thanks for this. I had a play around last night and managed to work around it by removing the menu link to the control panel from the user menu and just having individual links to the other account options, but your way will probably be cleaner, so i'll give this a try.

I have one other question though, as the percentage commission option calculates a percentage of the total order value. Is there a way to exclude the shipping costs from the commission calculation, as my client doesn't make any margin on shipping, so can't pay commission on this portion of the order?

Please Log in or Create an account to join the conversation.

  • Posts: 83103
  • Thank you received: 13418
  • MODERATOR
12 years 10 months ago #43998

There is no option for that, so you will have to modify the code:
In the file plugins/system/hikashopaffiliate.php you will find that code:
$order_price=$order->order_full_price*$user->user_params->partner_percent_fee/100;

That you can replace by:
$order_price=($order->order_full_price-$order->order_shipping_price)*$user->user_params->partner_percent_fee/100;

Please Log in or Create an account to join the conversation.

  • Posts: 4
  • Thank you received: 0
12 years 10 months ago #44007

Thanks Nicolas, just tried it and works perfectly.

Please Log in or Create an account to join the conversation.

Time to create page: 0.063 seconds
Powered by Kunena Forum