Attrexx Posted March 18, 2015 Share Posted March 18, 2015 (edited) Hello guys My client asked me to help with the tracking code implementation for an affiliate program. The code template was: <iframe height='1' width='1' scrolling='no' marginheight='0' marginwidth='0' frameborder='0' src='//event.2parale.ro/events/salecheck?amount=__ADD_SALE_VALUE__&campaign_unique=4dc7a465c&com_percent=__ADD_AFFILIATE_SALE_COMMISSION_PERCENT__&confirm=f3edf5277c44d4e6&transaction_id=__ADD_TRANSACTION_ID__&description=__ADD_DESCRIPTION__'></iframe> So I had 4 variables to customize (the ones in capital letters). With the help of another thread solved Jedi-style by Vekia, I managed to get 3 out of 4 variables to work. Thread is here: https://www.prestashop.com/forums/topic/250595-solved-affiliate-tracking-code/ The last one (and trickiest) is __ADD_AFFILIATE_SALE_COMMISSION_PERCENT__ My client has two different commissions: X% general commission and Y% for the SALE product category. I asked for some help from the affiliate network on this matter and the answer was: In the above example , if a user orders product A worth 10 EUR ( for which a commission of 10%) and product B worth 20 EUR ( 5% commission ) , the parameter__ADD_AFFILIATE_SALE_COMMISSION_PERCENT__ Is calculated as : 10% x 10 RON = 1 RON ( product A)5% x 20 RON = 1 RON ( product B )The total commission = 1 + 1 = 2 RONTotal order value = 10 RON + 20 RON = 30 RON__ADD_AFFILIATE_SALE_COMMISSION_PERCENT__ = Total amount of commission / total amount oforder x 100 = 2/30 x 100 = 7 % (rounded ) Needless to say that this answer sunk my fleet Question is: how do I translate the above quoted instruction into a variable to be inserted in the tracking code successfully? Thank you so much in advance for any help that may come this way Edited March 18, 2015 by Attrexx (see edit history) Link to comment Share on other sites More sharing options...
zeki893 Posted April 17, 2015 Share Posted April 17, 2015 How do you know which product has 10% or 5%? Does it belong in a special category or has a unique attribute? Based on that I think you can write something to distinguish between the two percentages. Link to comment Share on other sites More sharing options...
Attrexx Posted April 19, 2015 Author Share Posted April 19, 2015 Well the 10% is for all product categories except the 'SALE' category for which we have 5%.PHP is not my strong arm so I can't write that piece of code to distinguish &/or calculate differentially. Link to comment Share on other sites More sharing options...
Recommended Posts