[Skip to main content](#vessel-content)

#   Affiliate not tracking sales

##

- **[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")**
- [![mojweb's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/5128-mojweb "View mojweb's Profile") Topic Author
- [ Offline](/forum/user/5128-mojweb)

Less More

- Posts: 432
- Thank you received: 22
-

6 years 9 months ago [\#314881](#314881) by [mojweb](/forum/user/5128-mojweb "View mojweb's Profile")  *[Affiliate not tracking sales](/forum/39-affilation/899034-affiliate-not-tracking-sales#314881 "-- HikaShop version -- : 4.2.2 -- Joomla version -- : 3.9.14 -- PHP version -- : 7.2  I am able to see affiliate click logs registering however, no commissions are being added. All is configured as I can see appropriate including the plugin, order statuses and configuration pages. Aff cookie is served to customer. Order status is active for affiliate (confirmed and shipped).")* was created by *[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")*

-- HikaShop version -- : 4.2.2
-- Joomla version -- : 3.9.14
-- PHP version -- : 7.2

I am able to see affiliate click logs registering however, no commissions are being added. All is configured as I can see appropriate including the plugin, order statuses and configuration pages.
Aff cookie is served to customer. Order status is active for affiliate (confirmed and shipped).

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2FmZmlsYXRpb24vODk5MDM0LWFmZmlsaWF0ZS1ub3QtdHJhY2tpbmctc2FsZXM/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86363
- Thank you received: 14296
-
-

6 years 9 months ago [\#314886](#314886) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Affiliate not tracking sales](/forum/39-affilation/899034-affiliate-not-tracking-sales#314886 "-- HikaShop version -- : 4.2.2 -- Joomla version -- : 3.9.14 -- PHP version -- : 7.2  I am able to see affiliate click logs registering however, no commissions are being added. All is configured as I can see appropriate including the plugin, order statuses and configuration pages. Aff cookie is served to customer. Order status is active for affiliate (confirmed and shipped).")*

Can you provide a screenshot of the "affiliate" section of the HikaShop configuration so that we can see how you configured it ?
Can you provide also an affiliation link you're using and a screenshot of the settings of the user of the partner ?
Normally, regardless of the order status, you should see the partner in the order details when you edit the order in the backend.
If you don't, it means that the system didn't link the parameter in the URL to the partner/user when the order was created.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2FmZmlsYXRpb24vODk5MDM0LWFmZmlsaWF0ZS1ub3QtdHJhY2tpbmctc2FsZXM/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")**
- [![mojweb's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/5128-mojweb "View mojweb's Profile") Topic Author
- [ Offline](/forum/user/5128-mojweb)

Less More

- Posts: 432
- Thank you received: 22
-

6 years 9 months ago [\#314909](#314909) by [mojweb](/forum/user/5128-mojweb "View mojweb's Profile")  Replied by *[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")* on topic *[Affiliate not tracking sales](/forum/39-affilation/899034-affiliate-not-tracking-sales#314909 "-- HikaShop version -- : 4.2.2 -- Joomla version -- : 3.9.14 -- PHP version -- : 7.2  I am able to see affiliate click logs registering however, no commissions are being added. All is configured as I can see appropriate including the plugin, order statuses and configuration pages. Aff cookie is served to customer. Order status is active for affiliate (confirmed and shipped).")*

My config atached.
Can I send you link private?

- [ ![config.jpg](/forum/attachment/48585) ](/forum/attachment/48585 "config.jpg") [ ](/forum/attachment/48585?download=1 "config.jpg")
- [ ![config-partner.jpg](/forum/attachment/48586) ](/forum/attachment/48586 "...ig-partner.jpg") [ ](/forum/attachment/48586?download=1 "...ig-partner.jpg")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2FmZmlsYXRpb24vODk5MDM0LWFmZmlsaWF0ZS1ub3QtdHJhY2tpbmctc2FsZXM/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86363
- Thank you received: 14296
-
-

6 years 9 months ago [\#314912](#314912) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Affiliate not tracking sales](/forum/39-affilation/899034-affiliate-not-tracking-sales#314912 "-- HikaShop version -- : 4.2.2 -- Joomla version -- : 3.9.14 -- PHP version -- : 7.2  I am able to see affiliate click logs registering however, no commissions are being added. All is configured as I can see appropriate including the plugin, order statuses and configuration pages. Aff cookie is served to customer. Order status is active for affiliate (confirmed and shipped).")*

Hi,

The settings look fine.
I created an order with the link you provided. Could you provide a screenshot of the order details page when you open it via the menu Orders of the HikaShop backend ?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2FmZmlsYXRpb24vODk5MDM0LWFmZmlsaWF0ZS1ub3QtdHJhY2tpbmctc2FsZXM/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")**
- [![mojweb's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/5128-mojweb "View mojweb's Profile") Topic Author
- [ Offline](/forum/user/5128-mojweb)

Less More

- Posts: 432
- Thank you received: 22
-

6 years 9 months ago [\#314915](#314915) by [mojweb](/forum/user/5128-mojweb "View mojweb's Profile")  Replied by *[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")* on topic *[Affiliate not tracking sales](/forum/39-affilation/899034-affiliate-not-tracking-sales#314915 "-- HikaShop version -- : 4.2.2 -- Joomla version -- : 3.9.14 -- PHP version -- : 7.2  I am able to see affiliate click logs registering however, no commissions are being added. All is configured as I can see appropriate including the plugin, order statuses and configuration pages. Aff cookie is served to customer. Order status is active for affiliate (confirmed and shipped).")*

No sale.
This is important for us. Partner just lounch campain.
Thank you

- [ ![buypartner.jpg](/forum/attachment/48587) ](/forum/attachment/48587 "buypartner.jpg") [ ](/forum/attachment/48587?download=1 "buypartner.jpg")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2FmZmlsYXRpb24vODk5MDM0LWFmZmlsaWF0ZS1ub3QtdHJhY2tpbmctc2FsZXM/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")**
- [![mojweb's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/5128-mojweb "View mojweb's Profile") Topic Author
- [ Offline](/forum/user/5128-mojweb)

Less More

- Posts: 432
- Thank you received: 22
-

6 years 9 months ago [\#314919](#314919) by [mojweb](/forum/user/5128-mojweb "View mojweb's Profile")  Replied by *[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")* on topic *[Affiliate not tracking sales](/forum/39-affilation/899034-affiliate-not-tracking-sales#314919 "-- HikaShop version -- : 4.2.2 -- Joomla version -- : 3.9.14 -- PHP version -- : 7.2  I am able to see affiliate click logs registering however, no commissions are being added. All is configured as I can see appropriate including the plugin, order statuses and configuration pages. Aff cookie is served to customer. Order status is active for affiliate (confirmed and shipped).")*

Is this related?:
PHP Warning: strpos(): Empty needle in public_html/plugins/system/hikashopaffiliate/hikashopaffiliate.php on line 89

and
PHP Warning: Invalid argument supplied for foreach() in public_html/administrator/components/com_hikashop/classes/cart.php on line 2583

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2FmZmlsYXRpb24vODk5MDM0LWFmZmlsaWF0ZS1ub3QtdHJhY2tpbmctc2FsZXM/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")**
- [![Mohamed Thelji's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar6861.png)](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")
- [ Offline](/forum/user/6861-mohamed-thelji)

Less More

- Posts: 12953
- Thank you received: 1778
-
-
-

6 years 9 months ago [\#314924](#314924) by [Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")  Replied by *[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")* on topic *[Affiliate not tracking sales](/forum/39-affilation/899034-affiliate-not-tracking-sales#314924 "-- HikaShop version -- : 4.2.2 -- Joomla version -- : 3.9.14 -- PHP version -- : 7.2  I am able to see affiliate click logs registering however, no commissions are being added. All is configured as I can see appropriate including the plugin, order statuses and configuration pages. Aff cookie is served to customer. Order status is active for affiliate (confirmed and shipped).")*

Hello,

Yes it can be related, can you edit the file "plugins\system\hikashopaffiliate\hikashopaffiliate.php" and change these lines : Code:

// // $exclude_referers = explode(',', $config-&gt;get('affiliation_exclude_domains', '')); if(!empty($exclude_referers)) { $referer = null; if(!empty($_SERVER['HTTP_REFERER']) &amp;&amp; preg_match('#^https?://.*#i',$_SERVER['HTTP_REFERER'])) $referer = str_replace(array('"', '&lt;', '&gt;', "'"), '', @$_SERVER['HTTP_REFERER']); if(!empty($referer)) { foreach($exclude_referers as $ref) { $ref = trim($ref); if(strpos($referer, $ref) !== false) $cookie = false; } } } $exclude_referers = explode(',', $affiliation_exclude_domains); foreach($exclude_referers as $ref) { $ref = trim($ref); if(strpos($referer, $ref) !== false) $cookie = false; } } }

By : Code:

// // $affiliation_exclude_domains = $config-&gt;get('affiliation_exclude_domains', ''); if(!empty($affiliation_exclude_domains)) { $referer = null; if(!empty($_SERVER['HTTP_REFERER']) &amp;&amp; preg_match('#^https?://.*#i',$_SERVER['HTTP_REFERER'])) $referer = str_replace(array('"', '&lt;', '&gt;', "'"), '', @$_SERVER['HTTP_REFERER']); if(!empty($referer)) { $exclude_referers = explode(',', $affiliation_exclude_domains); foreach($exclude_referers as $ref) { $ref = trim($ref); if(strpos($referer, $ref) !== false) $cookie = false; } } }

And test it again ?
Kind regards,
Mohamed.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2FmZmlsYXRpb24vODk5MDM0LWFmZmlsaWF0ZS1ub3QtdHJhY2tpbmctc2FsZXM/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")**
- [![mojweb's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/5128-mojweb "View mojweb's Profile") Topic Author
- [ Offline](/forum/user/5128-mojweb)

Less More

- Posts: 432
- Thank you received: 22
-

6 years 9 months ago [\#314950](#314950) by [mojweb](/forum/user/5128-mojweb "View mojweb's Profile")  Replied by *[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")* on topic *[Affiliate not tracking sales](/forum/39-affilation/899034-affiliate-not-tracking-sales#314950 "-- HikaShop version -- : 4.2.2 -- Joomla version -- : 3.9.14 -- PHP version -- : 7.2  I am able to see affiliate click logs registering however, no commissions are being added. All is configured as I can see appropriate including the plugin, order statuses and configuration pages. Aff cookie is served to customer. Order status is active for affiliate (confirmed and shipped).")*

Will try. But I dont have that code. Now I have (complete file): Code:

&lt;?php /** * @package HikaShop for Joomla! * @version 4.2.2 * @author hikashop.com * @copyright (C) 2010-2019 HIKARI SOFTWARE. All rights reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html */ defined('_JEXEC') or die('Restricted access'); ?&gt;&lt;?php if(!defined('DS')) define('DS',DIRECTORY_SEPARATOR); jimport('joomla.plugin.plugin'); class plgSystemHikashopaffiliate extends JPlugin { public function __construct(&amp;$subject, $config) { parent::__construct($subject, $config); if(isset($this-&gt;params)) return; $plugin = JPluginHelper::getPlugin('system', 'hikashopaffiliate'); $this-&gt;params = new JRegistry(@$plugin-&gt;params); } public function afterInitialise() { return $this-&gt;onAfterInitialise(); } public function onAfterInitialise() { $do = $this-&gt;params-&gt;get('after_init','1'); if($do) return $this-&gt;onAfterRoute(); return true; } public function afterRoute() { return $this-&gt;onAfterRoute(); } public function onAfterRoute() { $app = JFactory::getApplication(); if(version_compare(JVERSION,'4.0','&gt;=') &amp;&amp; $app-&gt;isClient('administrator')) return true; if(version_compare(JVERSION,'4.0','&lt;') &amp;&amp; $app-&gt;isAdmin()) return true; if(@$_REQUEST['option'] == 'com_gcalendar') return true; $key_name = $this-&gt;params-&gt;get('partner_key_name', 'partner_id'); if(version_compare(JVERSION,'3.0','&gt;=')) $partner_id = $app-&gt;input-&gt;getCmd($key_name, 0); else $partner_id = JRequest::getCmd($key_name, 0); if(empty($partner_id)) return true; static $done = false; if($done) return true; $done = true; if(!include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php')) return true; $partner_id = hikashop_decode($partner_id,'partner'); $userClass = hikashop_get('class.user'); $user = $userClass-&gt;get($partner_id); if(empty($user-&gt;user_partner_activated)) return true; $config = hikashop_config(); $cookie = true; if($config-&gt;get('no_affiliation_if_cart_present')) { $cart_id = $app-&gt;getUserState(HIKASHOP_COMPONENT.'.cart_id', 0, 'int'); if($cart_id) $cookie = false; } $exclude_referers = explode(',', $config-&gt;get('affiliation_exclude_domains', '')); if(!empty($exclude_referers)) { $referer = null; if(!empty($_SERVER['HTTP_REFERER']) &amp;&amp; preg_match('#^https?://.*#i',$_SERVER['HTTP_REFERER'])) $referer = str_replace(array('"', '&lt;', '&gt;', "'"), '', @$_SERVER['HTTP_REFERER']); if(!empty($referer)) { foreach($exclude_referers as $ref) { $ref = trim($ref); if(strpos($referer, $ref) !== false) $cookie = false; } } } if($cookie) setcookie('hikashop_affiliate', hikashop_encode($partner_id,'partner'), time() + $config-&gt;get('click_validity_period', 2592000), '/'); $ip = hikashop_getIP(); $clickClass = hikashop_get('class.click'); $latest = $clickClass-&gt;getLatest($partner_id, $ip, $config-&gt;get('click_min_delay', 86400)); if(empty($user-&gt;user_params-&gt;user_custom_fee)) { $user-&gt;user_params-&gt;partner_click_fee = $config-&gt;get('partner_click_fee',0); $user-&gt;user_params-&gt;partner_fee_currency = $config-&gt;get('partner_currency',1); } else { $user-&gt;user_params-&gt;partner_click_fee = $user-&gt;user_params-&gt;user_partner_click_fee; } if(!$config-&gt;get('allow_currency_selection',0) &#124;&#124; empty($user-&gt;user_currency_id)) $user-&gt;user_currency_id = $config-&gt;get('partner_currency',1); if(bccomp($user-&gt;user_params-&gt;partner_click_fee,0,5) &amp;&amp; $user-&gt;user_currency_id!=$user-&gt;user_params-&gt;partner_fee_currency) $user-&gt;user_params-&gt;partner_click_fee = $this-&gt;_convert($user-&gt;user_params-&gt;partner_click_fee,$user-&gt;user_params-&gt;partner_fee_currency,$user-&gt;user_currency_id); if(!empty($latest)) $user-&gt;user_params-&gt;partner_click_fee = 0; $click = new stdClass(); $click-&gt;click_partner_id = $partner_id; $click-&gt;click_ip = $ip; $click-&gt;click_partner_price = $user-&gt;user_params-&gt;partner_click_fee; $click-&gt;click_partner_currency_id = $user-&gt;user_currency_id; $clickClass-&gt;save($click); return true; } public function onBeforeOrderUpdate(&amp;$order,&amp;$do){ if(!empty($order-&gt;order_type) &amp;&amp; $order-&gt;order_type != 'sale') return; if(!empty($order-&gt;old-&gt;order_type) &amp;&amp; $order-&gt;old-&gt;order_type != 'sale') return; if(!empty($order-&gt;order_partner_paid)) return true; if(!isset($order-&gt;order_full_price)) return true; if(!empty($order-&gt;old)) { if(!empty($order-&gt;old-&gt;order_partner_paid)) return true; if(floatval($order-&gt;old-&gt;order_full_price) == floatval($order-&gt;order_full_price)) return true; if(empty($order-&gt;order_partner_id)) $order-&gt;order_partner_id = $order-&gt;old-&gt;order_partner_id; return $this-&gt;onBeforeOrderCreate($order, $do); } return true; } public function getPartner(&amp;$order) { $config =&amp; hikashop_config(); if($config-&gt;get('add_partner_to_user_account', 0) &amp;&amp; !empty($order-&gt;order_user_id)) { $class = hikashop_get('class.user'); $user = $class-&gt;get($order-&gt;order_user_id); if(!empty($user-&gt;user_partner_id)) return $user-&gt;user_partner_id; } return hikashop_decode(hikaInput::get()-&gt;cookie-&gt;getCmd('hikashop_affiliate', 0), 'partner'); } public function onBeforeOrderCreate(&amp;$order, &amp;$do) { $app = JFactory::getApplication(); if(!empty($order-&gt;order_type) &amp;&amp; $order-&gt;order_type != 'sale') return; if(empty($order-&gt;order_partner_id)) { if(hikashop_isClient('administrator')) return true; if(!empty($order-&gt;order_discount_code)) { $discountClass = hikashop_get('class.discount'); $coupon = $discountClass-&gt;load($order-&gt;order_discount_code); if(isset($coupon-&gt;discount_affiliate) &amp;&amp; $coupon-&gt;discount_affiliate == -1) { return true; } elseif(isset($coupon-&gt;discount_affiliate) &amp;&amp; $coupon-&gt;discount_affiliate) { $partner_id = $coupon-&gt;discount_affiliate; $userClass = hikashop_get('class.user'); $user = $userClass-&gt;get($order-&gt;order_user_id); if($user-&gt;user_cms_id) { $this-&gt;addPartnerToUser($user-&gt;user_cms_id, $partner_id); } } else { $partner_id = $this-&gt;getPartner($order); } } else { $partner_id = $this-&gt;getPartner($order); } if(empty($partner_id)) return true; } else { $partner_id = $order-&gt;order_partner_id; } $config =&amp; hikashop_config(); if($config-&gt;get('no_self_affiliation', 0) &amp;&amp; $order-&gt;order_user_id == $partner_id) return true; $userClass = hikashop_get('class.user'); $user = $userClass-&gt;get($partner_id); if(empty($user)) return true; if(empty($user-&gt;user_partner_activated)) return true; $order-&gt;order_partner_id = $partner_id; if(empty($user-&gt;user_params-&gt;user_custom_fee)) { $user-&gt;user_params-&gt;partner_percent_fee = $config-&gt;get('partner_percent_fee',0); $user-&gt;user_params-&gt;partner_flat_fee = $config-&gt;get('partner_flat_fee',0); $user-&gt;user_params-&gt;partner_fee_currency = $config-&gt;get('partner_currency',1); } else { $user-&gt;user_params-&gt;partner_percent_fee = $user-&gt;user_params-&gt;user_partner_percent_fee; $user-&gt;user_params-&gt;partner_flat_fee =$user-&gt;user_params-&gt;user_partner_flat_fee; } if(!$config-&gt;get('allow_currency_selection',0) &#124;&#124; empty($user-&gt;user_currency_id)) $user-&gt;user_currency_id = $config-&gt;get('partner_currency',1); if(bccomp($user-&gt;user_params-&gt;partner_flat_fee,0,5) &amp;&amp; $user-&gt;user_currency_id!=$user-&gt;user_params-&gt;partner_fee_currency) $user-&gt;user_params-&gt;partner_flat_fee = $this-&gt;_convert($user-&gt;user_params-&gt;partner_flat_fee,$user-&gt;user_params-&gt;partner_fee_currency,$user-&gt;user_currency_id); if(bccomp($user-&gt;user_params-&gt;partner_percent_fee, 0, 5) &#124;&#124; bccomp($user-&gt;user_params-&gt;partner_flat_fee, 0, 5)) { if(bccomp($user-&gt;user_params-&gt;partner_percent_fee, 0, 5)) { $order_price = $order-&gt;order_full_price; if($config-&gt;get('affiliate_fee_exclude_shipping', 0)) { $order_price = $order_price - $order-&gt;order_shipping_price; } $fees = $order_price*$user-&gt;user_params-&gt;partner_percent_fee/100; } else { $fees = 0; } if($order-&gt;order_currency_id!=$user-&gt;user_currency_id) $fees = $this-&gt;_convert($fees,$order-&gt;order_currency_id,$user-&gt;user_currency_id); $order-&gt;order_partner_price = $fees + $user-&gt;user_params-&gt;partner_flat_fee; $order-&gt;order_partner_currency_id = $user-&gt;user_currency_id; } return true; } protected function _convert($amount,$src_id,$dst_id) { $currencyClass = hikashop_get('class.currency'); $config =&amp; hikashop_config(); $setcurrencies = null; $main_currency = (int)$config-&gt;get('main_currency',1); $ids[$src_id] = $src_id; $ids[$dst_id] = $dst_id; $ids[$main_currency] = $main_currency; $currencies = $currencyClass-&gt;getCurrencies($ids,$setcurrencies); $srcCurrency = $currencies[$src_id]; $dstCurrency = $currencies[$dst_id]; $mainCurrency = $currencies[$main_currency]; if($srcCurrency-&gt;currency_id != $mainCurrency-&gt;currency_id) { $amount = floatval($amount) / floatval($srcCurrency-&gt;currency_rate); $amount += $amount * floatval($srcCurrency-&gt;currency_percent_fee) / 100.0; } if($dstCurrency-&gt;currency_id != $mainCurrency-&gt;currency_id) { $amount = floatval($amount) * floatval($dstCurrency-&gt;currency_rate); $amount += $amount * floatval($dstCurrency-&gt;currency_percent_fee)/100.0; } return $amount; } public function onUserAfterSave($user, $isnew, $success, $msg) { return $this-&gt;onAfterStoreUser($user, $isnew, $success, $msg); } public function onAfterStoreUser($user, $isnew, $success, $msg){ if($success === false) return false; $app = JFactory::getApplication(); $admin = false; if(version_compare(JVERSION,'4.0','&gt;=') &amp;&amp; $app-&gt;isClient('administrator')) $admin = true; if(version_compare(JVERSION,'4.0','&lt;') &amp;&amp; $app-&gt;isAdmin()) $admin = true; if($admin &#124;&#124; !$isnew) return true; if(!include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php')) return true; $partner_id = hikaInput::get()-&gt;cookie-&gt;getCmd('hikashop_affiliate', 0); if(empty($partner_id)) return true; $partner_id = hikashop_decode($partner_id,'partner'); $this-&gt;addPartnerToUser($user['id'], $partner_id); return true; } public function onBeforeHikaUserRegistration(&amp;$ret, $input_data, $mode) { $config = hikashop_config(); $formData = hikaInput::get()-&gt;get('data', array(), 'array'); if($config-&gt;get('affiliate_registration', 0) &amp;&amp; !empty($formData['affiliate'])) { $ret['userData']-&gt;user_partner_activated = 1; $ret['registerData']-&gt;user_partner_activated = 1; } } protected function addPartnerToUser($user_id, $partner_id){ $userClass = hikashop_get('class.user'); $partner = $userClass-&gt;get($partner_id); if(empty($partner-&gt;user_partner_activated)) return true; $config =&amp; hikashop_config(); if(empty($partner-&gt;user_params-&gt;user_custom_fee)) { $partner-&gt;user_params-&gt;partner_lead_fee = $config-&gt;get('partner_lead_fee',0); $partner-&gt;user_params-&gt;partner_fee_currency = $config-&gt;get('partner_currency',1); } else { $partner-&gt;user_params-&gt;partner_lead_fee = $partner-&gt;user_params-&gt;user_partner_lead_fee; } if(!$config-&gt;get('allow_currency_selection',0) &#124;&#124; empty($partner-&gt;user_currency_id)) $partner-&gt;user_currency_id = $config-&gt;get('partner_currency',1); if(bccomp($partner-&gt;user_params-&gt;partner_lead_fee,0,5) &amp;&amp; $partner-&gt;user_currency_id!=$partner-&gt;user_params-&gt;partner_fee_currency) $partner-&gt;user_params-&gt;partner_lead_fee = $this-&gt;_convert($partner-&gt;user_params-&gt;partner_lead_fee,$partner-&gt;user_params-&gt;partner_fee_currency,$partner-&gt;user_currency_id); $ip = hikashop_getIP(); $clickClass = hikashop_get('class.click'); $latest = $clickClass-&gt;getLatest($partner_id,$ip,$config-&gt;get('lead_min_delay',24)); if($config-&gt;get('add_partner_to_user_account',0) &#124;&#124; (empty($latest) &amp;&amp; bccomp($partner-&gt;user_params-&gt;partner_lead_fee,0,5))) { $userDataInDb = $userClass-&gt;get($user_id,'cms'); $userData = new stdClass(); $userData-&gt;user_id = @$userDataInDb-&gt;user_id; $userData-&gt;user_cms_id = $user_id; $userData-&gt;user_partner_id = $partner_id; $userData-&gt;user_partner_price = @$partner-&gt;user_params-&gt;partner_lead_fee; $userData-&gt;user_partner_currency_id = $partner-&gt;user_currency_id; $userClass-&gt;save($userData); } } public function onUserAccountDisplay(&amp;$buttons) { $button = $this-&gt;params-&gt;get('button_on_control_panel','1'); if(!$button) return; global $Itemid; $url_itemid = ''; if(!empty($Itemid)) $url_itemid = '&amp;Itemid=' . $Itemid; $buttons['affiliate'] = array( 'link' =&gt; hikashop_completeLink('affiliate'.$url_itemid), 'level' =&gt; 1, 'image' =&gt; 'affiliate', 'text' =&gt; JText::_('AFFILIATE'), 'description' =&gt; JText::_('AFFILIATE_PROGRAM'), 'fontawesome' =&gt; ''. '&lt;i class="fas fa-user fa-stack-2x"&gt;&lt;/i&gt;'. '&lt;i class="fas fa-circle fa-stack-1x fa-inverse" style="top:30%;left:30%;"&gt;&lt;/i&gt;'. '&lt;i class="fas fa-dollar-sign fa-stack-1x" style="top:30%;left:30%;"&gt;&lt;/i&gt;' ); return true; } public function onBeforeOrderListing($paramBase, &amp;$extrafilters, &amp;$pageInfo, &amp;$filters) { $app = JFactory::getApplication(); if(!hikashop_isClient('administrator')) return; $pageInfo-&gt;filter-&gt;filter_partner = $app-&gt;getUserStateFromRequest($paramBase.".filter_partner",'filter_partner','','int'); $extrafilters['filter_partner'] =&amp; $this; if(!empty($pageInfo-&gt;filter-&gt;filter_partner)) { if($pageInfo-&gt;filter-&gt;filter_partner == 1) { $filters[] = 'b.order_partner_id != 0'; } else { $filters[] = 'b.order_partner_id = 0'; } } } public function onAfterOrderListing(&amp;$rows, &amp;$extrafields, $pageInfo) { $app = JFactory::getApplication(); if(!hikashop_isClient('administrator')) return; $myextrafield = new stdClass(); $myextrafield-&gt;name = JText::_('PARTNER'); $myextrafield-&gt;obj =&amp; $this; $extrafields['partner'] = $myextrafield; } public function displayFilter($name, $filter) { $partner = hikashop_get('type.user_partner'); return $partner-&gt;display('filter_partner', $filter-&gt;filter_partner, false); } public function showField($container, $name, &amp;$row) { if(!bccomp($row-&gt;order_partner_price, 0, 5)) return ''; $ret = $container-&gt;currencyHelper-&gt;format($row-&gt;order_partner_price,$row-&gt;order_partner_currency_id); if(empty($row-&gt;order_partner_paid)) { $ret .= JText::_('NOT_PAID'); } else { $ret .= JText::_('PAID').'&lt;img src="'.HIKASHOP_IMAGES.'ok.png" /&gt;'; } return $ret; } public function onDiscountBlocksDisplay(&amp;$discount, &amp;$html) { $options = array( JHTML::_('select.option', -1, JText::_('NO_PARTNER')), JHTML::_('select.option', 0, JText::_('CURRENT_CUSTOMER_PARTNER')) ); $db = JFactory::getDBO(); $db-&gt;setQuery('SELECT a.user_id, b.name, b.username FROM #__hikashop_user AS a LEFT JOIN #__users AS b ON a.user_cms_id = b.id WHERE a.user_partner_activated = 1 ORDER BY b.username', 0, 250); $partners = $db-&gt;loadObjectList(); if(!empty($partners)) { foreach($partners as $partner) { $options[] = JHTML::_('select.option', $partner-&gt;user_id, $partner-&gt;username.' ('.$partner-&gt;name.')'); } } $html[] = '&lt;dt data-discount-display="coupon"&gt;&lt;label&gt;'. JText::_('FORCE_AFFILIATION_TO') .'&lt;/label&gt;&lt;/dt&gt;&lt;dd data-discount-display="coupon"&gt;'. JHTML::_('hikaselect.genericlist', $options, 'data[discount][discount_affiliate]' , 'class="custom-select"', 'value', 'text', @$discount-&gt;discount_affiliate ). '&lt;/dd&gt;'; } function onOrderStatusListingLoad( &amp;$orderstatus_columns, &amp;$rows){ $orderstatus_columns['affiliate'] = array( 'text' =&gt; JText::_('AFFILIATE'), 'title' =&gt; JText::_('VALID_ORDER_STATUS'), 'description' =&gt; JText::_('AFFILIATE_DESC'), 'key' =&gt; 'partner_valid_status', 'default' =&gt; 'confirmed,shipped', 'type' =&gt; 'toggle', 'trigger' =&gt; 'plg.system.hikashopaffiliate.affiliateStatusUpdate' ); } function affiliateStatusUpdate(&amp;$controller, $elementPkey, $value, $extra){ return $controller-&gt;configstatus($elementPkey,$value, $extra); } }

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2FmZmlsYXRpb24vODk5MDM0LWFmZmlsaWF0ZS1ub3QtdHJhY2tpbmctc2FsZXM/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")**
- [![mojweb's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/5128-mojweb "View mojweb's Profile") Topic Author
- [ Offline](/forum/user/5128-mojweb)

Less More

- Posts: 432
- Thank you received: 22
-

6 years 9 months ago [\#314957](#314957) by [mojweb](/forum/user/5128-mojweb "View mojweb's Profile")  Replied by *[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")* on topic *[Affiliate not tracking sales](/forum/39-affilation/899034-affiliate-not-tracking-sales#314957 "-- HikaShop version -- : 4.2.2 -- Joomla version -- : 3.9.14 -- PHP version -- : 7.2  I am able to see affiliate click logs registering however, no commissions are being added. All is configured as I can see appropriate including the plugin, order statuses and configuration pages. Aff cookie is served to customer. Order status is active for affiliate (confirmed and shipped).")*

I replaced code, but affiliate is not tracking sale. I can see click, but not sale.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2FmZmlsYXRpb24vODk5MDM0LWFmZmlsaWF0ZS1ub3QtdHJhY2tpbmctc2FsZXM/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86363
- Thank you received: 14296
-
-

6 years 9 months ago [\#314961](#314961) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Affiliate not tracking sales](/forum/39-affilation/899034-affiliate-not-tracking-sales#314961 "-- HikaShop version -- : 4.2.2 -- Joomla version -- : 3.9.14 -- PHP version -- : 7.2  I am able to see affiliate click logs registering however, no commissions are being added. All is configured as I can see appropriate including the plugin, order statuses and configuration pages. Aff cookie is served to customer. Order status is active for affiliate (confirmed and shipped).")*

Hi,

I'm afraid it will require a FTP and a backend access so that we can debug the issue as we are not able to reproduce it on our end.
Could you provide that along with a link to this thread via our contact form ?
[ www.hikashop.com/support/contact-us.html](https://www.hikashop.com/support/contact-us.html)

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2FmZmlsYXRpb24vODk5MDM0LWFmZmlsaWF0ZS1ub3QtdHJhY2tpbmctc2FsZXM/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")**
- [![mojweb's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/5128-mojweb "View mojweb's Profile") Topic Author
- [ Offline](/forum/user/5128-mojweb)

Less More

- Posts: 432
- Thank you received: 22
-

6 years 9 months ago [\#314981](#314981) by [mojweb](/forum/user/5128-mojweb "View mojweb's Profile")  Replied by *[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")* on topic *[Affiliate not tracking sales](/forum/39-affilation/899034-affiliate-not-tracking-sales#314981 "-- HikaShop version -- : 4.2.2 -- Joomla version -- : 3.9.14 -- PHP version -- : 7.2  I am able to see affiliate click logs registering however, no commissions are being added. All is configured as I can see appropriate including the plugin, order statuses and configuration pages. Aff cookie is served to customer. Order status is active for affiliate (confirmed and shipped).")*

Done, thank you.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2FmZmlsYXRpb24vODk5MDM0LWFmZmlsaWF0ZS1ub3QtdHJhY2tpbmctc2FsZXM/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")**
- [![mojweb's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/5128-mojweb "View mojweb's Profile") Topic Author
- [ Offline](/forum/user/5128-mojweb)

Less More

- Posts: 432
- Thank you received: 22
-

6 years 9 months ago [\#315086](#315086) by [mojweb](/forum/user/5128-mojweb "View mojweb's Profile")  Replied by *[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")* on topic *[Affiliate not tracking sales](/forum/39-affilation/899034-affiliate-not-tracking-sales#315086 "-- HikaShop version -- : 4.2.2 -- Joomla version -- : 3.9.14 -- PHP version -- : 7.2  I am able to see affiliate click logs registering however, no commissions are being added. All is configured as I can see appropriate including the plugin, order statuses and configuration pages. Aff cookie is served to customer. Order status is active for affiliate (confirmed and shipped).")*

Any news on that?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2FmZmlsYXRpb24vODk5MDM0LWFmZmlsaWF0ZS1ub3QtdHJhY2tpbmctc2FsZXM/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86363
- Thank you received: 14296
-
-

6 years 9 months ago [\#315095](#315095) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Affiliate not tracking sales](/forum/39-affilation/899034-affiliate-not-tracking-sales#315095 "-- HikaShop version -- : 4.2.2 -- Joomla version -- : 3.9.14 -- PHP version -- : 7.2  I am able to see affiliate click logs registering however, no commissions are being added. All is configured as I can see appropriate including the plugin, order statuses and configuration pages. Aff cookie is served to customer. Order status is active for affiliate (confirmed and shipped).")*

Hi,

I did some debugging today and I think I found the issue.
You have an auto loaded coupon on the order and the coupon is configured to deactivate the affiliation thanks to the "Force affiliation to" setting :
[ monosnap.com/file/Q2aZH6Q5ezjo6i0FxaHyntlQCEKsSz](https://monosnap.com/file/Q2aZH6Q5ezjo6i0FxaHyntlQCEKsSz)
So the affiliation is ignored because of that, even if the coupon has a value of 0 ( for free shipping, that's the case since you only configured a 100% shipping percentage and no flat amount or percentage of the products).

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2FmZmlsYXRpb24vODk5MDM0LWFmZmlsaWF0ZS1ub3QtdHJhY2tpbmctc2FsZXM/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")**
- [![mojweb's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/5128-mojweb "View mojweb's Profile") Topic Author
- [ Offline](/forum/user/5128-mojweb)

Less More

- Posts: 432
- Thank you received: 22
-

6 years 9 months ago [\#315098](#315098) by [mojweb](/forum/user/5128-mojweb "View mojweb's Profile")  Replied by *[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")* on topic *[Affiliate not tracking sales](/forum/39-affilation/899034-affiliate-not-tracking-sales#315098 "-- HikaShop version -- : 4.2.2 -- Joomla version -- : 3.9.14 -- PHP version -- : 7.2  I am able to see affiliate click logs registering however, no commissions are being added. All is configured as I can see appropriate including the plugin, order statuses and configuration pages. Aff cookie is served to customer. Order status is active for affiliate (confirmed and shipped).")*

Hm, so what settings on coupon should I set? Current customer partner?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2FmZmlsYXRpb24vODk5MDM0LWFmZmlsaWF0ZS1ub3QtdHJhY2tpbmctc2FsZXM/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86363
- Thank you received: 14296
-
-

6 years 9 months ago [\#315100](#315100) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Affiliate not tracking sales](/forum/39-affilation/899034-affiliate-not-tracking-sales#315100 "-- HikaShop version -- : 4.2.2 -- Joomla version -- : 3.9.14 -- PHP version -- : 7.2  I am able to see affiliate click logs registering however, no commissions are being added. All is configured as I can see appropriate including the plugin, order statuses and configuration pages. Aff cookie is served to customer. Order status is active for affiliate (confirmed and shipped).")*

Yes.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2FmZmlsYXRpb24vODk5MDM0LWFmZmlsaWF0ZS1ub3QtdHJhY2tpbmctc2FsZXM/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.083 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
