Different affiliation credit for different products

  • Posts: 308
  • Thank you received: 6
  • Hikaserial Standard Hikaserial Subscription Hikashop Business
7 months 1 week ago #299183

-- HikaShop version -- : 3.5.1
-- Joomla version -- : 3.8.13
-- PHP version -- : 7.2
-- Browser(s) name and version -- : various all updated

I have a request I could find no solution.

My client wants to provide a coupon to affiliates so customer receives a $30 discount on products. No problem.

However, she wants the affiliate to get $100 for a sale of product A and to get $20 for a sale of product B. In the Configuration / Features / Affiliation, it appears that this is not possible.

Is this possible and how can I provide this functionality? If not possible, what is the best functionality to come close to meeting this need.

A quick response would be great as she has a training session on Friday and I'm leaving on Thursday. :)

Thanks.

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

  • Posts: 65715
  • Thank you received: 9593
  • MODERATOR
7 months 1 week ago #299187

Hi,

There is indeed no option to do that.
Adding that capability to the Affiliate system wouldn't be that easy but it's in the realm of possibilities.
I can however offer an alternative.
With the integration with AcyMailing, it's possible to configure two different email, each one with a different coupon tag, and with a different filter for the mass action to trigger them.
So you could restrict each email to a different product thanks to that. And the coupon tag would automatically generate a unique coupon in HikaShop when the email is sent so that the customer could use the coupon code for his next order on the website.

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

  • Posts: 308
  • Thank you received: 6
  • Hikaserial Standard Hikaserial Subscription Hikashop Business
7 months 1 week ago #299238

Nicolas,

I pretty much had assumed that this functionality was not available as I had already done significant research into this issue. In looking at the AcyMailing workaround, it creates another issue that I'm pretty sure the client does not want which is multiple emails per affiliate.

If at some point in the future, you decide to implement functionality like this, I believe a single map table could achieve it with cross-mapping a fixed commission or percentage commission (options) to a product or product category with a field for the affiliate ID. Just a thought.

Thanks for confirming what I suspected. I'm going to try and convince the client to go with the either a percentage fee on sales or a flat fee on sales to stay within the HikaShop build-in functionality.

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

  • Posts: 65715
  • Thank you received: 9593
  • MODERATOR
7 months 1 week ago #299240

Hi,

Yes, a cross table was also what I was thinking about when talking about the possibility of adding that.
There are two main things we could improve with the affiliate system. One is that above-mentioned capability. The second is to handle multi-tier fees. However, the multi-tier fees would require rewriting pretty much the whole thing.

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

  • Posts: 308
  • Thank you received: 6
  • Hikaserial Standard Hikaserial Subscription Hikashop Business
7 months 1 week ago #299255

Nic,

I can see where the multi-tier would require a major rewrite. Baby steps. Add the cross-map table first with different affiliate settings on products and/or categories at some point in the future. :)

Don't we always want our cake AND icing!!! LOL

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

  • Posts: 308
  • Thank you received: 6
  • Hikaserial Standard Hikaserial Subscription Hikashop Business
7 months 1 week ago #299291

Nic,

I was trying to think outside the box and this ability could be done via the individual coupon 'Restrictions'. If an affiliate is specified, there could be two fields that could appear or be editable at that point. One as a drop-down option for Fixed Amount or Percentage and the other one where a figure could be entered. Then if there is a sale that uses this coupon, the affiliate "Unpaid amount for sales" can be updated for what the affiliate gets with this specific coupon. That might be a lot easier to accomplish instead of using a cross-map table between the affiliate and the product since the coupon could be restricted to products or categories. Now this would still require 'two' coupons per affiliate for my client but that would be something they would have to live with...at least for now until some type of cross-map solution is implemented.

Just a thought.

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

  • Posts: 65715
  • Thank you received: 9593
  • MODERATOR
7 months 1 week ago #299294

Hi,

The partner setting in the coupon works the other way around. If the coupon is used by the customer for an order, the order will be affiliated to that partner regardless of whether the customer comes from an affiliated website, search engines, etc.
So if you have several coupons, one or two for each partner, and supposing that you have the auto-load in cart if possible setting activated, then the system would automatically pick the coupon which is the most interesting for the customer and use the partner of that coupon. But you want the opposite: to force the coupon being used based on the partner of the customer.
That's possible with the coupons, but it would require also implement the coupon API to add your check of the partner in order to select the correct coupon and filter out the others.
So it's feasible I guess, but not that practical.

Personally, if I were to do that job as a custom development, I would make it simpler:
- make a copy of the affiliate plugin (naming it myaffiliate or whatever) so that I could install it next to the normal affiliate plugin
- I would change the partner key setting of the default plugin and change the cookie name in my custom affiliate plugin so that there is no interference between the too (I just keep the default one activated so that the affiliate feature is not disabled in the different places of HikaShop)
- Then, in my affiliate plugin, I would add a new setting where I could enter the map of the categories and their fees like that:
10=2;11=3
where the products of the category 10 would get a 2% fee, and the products of the category 11 would get a 3% fee.
- And finally, I would rewrite the function onBeforeOrderCreate to discard the fees or recalculate them based on the products in the order and the map entered in the settings of the plugin.That's one or two MySQL queries with 20 to 40 lines of code based on how far you want to go with the capabilities.
It's lightweight, easy to manage for the merchant, relatively easy to develop.

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

  • Posts: 308
  • Thank you received: 6
  • Hikaserial Standard Hikaserial Subscription Hikashop Business
7 months 5 days ago #299372

Nicolas,

I would like to make a custom affiliate plugin as you outlined but I have one issue. I could NOT find an affiliate plugin under the /plugins/hikashop folder. I checked under the administrator and component but couldn't find anything that looked like an affiliate plugin.

Can you tell me where this file will be located?

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

  • Posts: 65715
  • Thank you received: 9593
  • MODERATOR
7 months 4 days ago #299399

Hi,

It's in the "system" group, so you'll find it in the folder plugins/system/hikashopaffiliate/

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

  • Posts: 308
  • Thank you received: 6
  • Hikaserial Standard Hikaserial Subscription Hikashop Business
7 months 3 days ago #299447

Nicolas,

OK, I found the plugin and created a clone "myhikashopaffiliate.php" file.

I changed all references to 'hikashop_affiliate' to 'myhikashop_affiliate'.

I searched and the only partner 'key' code I could find was the code below in the onAfterRoute function.

$key_name = $this->params->get('partner_key_name', 'partner_id');
$partner_id = JRequest::getCmd($key_name,0);

I was thinking of changing this to:
$key_name = $this->params->get('my_partner_key_name', 'partner_id');
$partner_id = JRequest::getCmd($key_name,0);

But in your instructions (shown below), you indicated to make this change in the 'default plugin'. So should I make this change in the 'hikashopaffiliate.php' file or in my clone 'myhikashopaffiliate.php' file?

- I would change the partner key setting of the default plugin and change the cookie name in my custom affiliate plugin so that there is no interference between the too (I just keep the default one activated so that the affiliate feature is not disabled in the different places of HikaShop)


You indicated to create a new setting to map out the categories with a percentage. In looking at the code, I do not see any retrieval of the "hikashop_product_category" table where the cross-mapping is done for categories and products. Is this correct?

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

  • Posts: 65715
  • Thank you received: 9593
  • MODERATOR
7 months 2 days ago #299464

Hi,

No, you don't need to change that code. It's a setting of the plugin that you can change via the Joomla plugins manager.

The setting I was saying to create is just to make it easy to change in the future, without having to open the file and go through the code to change the mapping.
Creating a setting of a plugin can be done in the XML of the plugin. And then, you can read the content of the setting like that:
$my_param = $this->params->get('my_param_name');
Then, once you have the mapping in $my_param you can just use PHP to process it.

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

Time to create page: 0.072 seconds
Powered by Kunena Forum