Forums / All Other Contributions/Addons / Integrating Post Affilate Pro with Zen Cart

Integrating Post Affilate Pro with Zen Cart

Locked

Views: 1,749

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
17 Oct 2008, 1:18 PM
#1
philmoulds avatar

philmoulds

New Zenner

Join Date:
Mar 2008
Posts:
13
Plugin Contributions:
0

Integrating Post Affilate Pro with Zen Cart

Hi all

Just a quick question that I'm hoping someone can help me with please. I have integrated PostAffiliatePro with my Zen shopping cart but have a small problem.

I have created my affiliate program to pay affiliates 20% of the value of the order. I have just had an order which was processed with a discount coupon used (20% discount) and this reduced the price of the product from £21.95 to £17.56.

However... PAP calculated the commission based on the original £21.95 and 'awarded' this as £4.39. It should be more like £3.51 (20% of £17.56).

The code that the PAP guys advise to use is this:

<? $dbreq = $db->Execute("select * from " . TABLE_ORDERS_TOTAL . " where orders_id = '".(int)$orders->fields['orders_id']."' AND class = 'ot_subtotal'"); $totalCost = (number_format($dbreq->fields['value'],2,'.','')); $orderId = $dbreq->fields['orders_id']; print '<script id="pap_x2s6df8d" src="http://canvascrew.co.uk/go/scripts/sale.js" type="text/javascript"></script> <script type="text/javascript"> <!-- var TotalCost="'.$totalCost.'"; var OrderID="'.$orderId.'"; var ProductID=""; papSale(); --> </script>'; ?>

but I presume that there must be some value that needs changing to pay the correct amount, once discounts have been taken into account?

Also, some products have an additional shipping cost added to them - does this mean if one of these are ordered through an affiliate link I will also pay commission on the shipping fee using the code that I have pasted above?

Please can anyone advise me what needs changing to fix this, I can dabble with the code OK with instructions but haven't got a clue about finding the answer to this!

Any help/advice would be greatly appreciated

Many thanks in advance

Phil

17 Oct 2008, 1:42 PM
#2
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Integrating Post Affilate Pro with Zen Cart

Yeah... looks like it's not allowing for removal of shipping and coupon discounts before calculating the affiliate fee.

I tried Post Affiliate Pro for a while and dumped it in frustration, then installed JROX JAM.

JROX is the most brilliant, fantastic and wonderful system...

(and no, I don't have shares in JROX!)

20 years a Zencart User

20 Oct 2008, 8:04 AM
#3
marosf avatar

marosf

New Zenner

Join Date:
Mar 2006
Posts:
2
Plugin Contributions:
0

Re: Integrating Post Affilate Pro with Zen Cart

Hi,

I'm the main developer of Post Affiliate Pro.

I will not comment JROX, but if you check their integration with ZenCart you'll see they copied it from us, so they don't have any handling for discounts either.

The problem with discount in ZenCart can be solved only by customization of the integration method, we'd have to look at it to find a solution.

Phil, you are in contact with our support, we'll try to find the solution with them.

regards,

Mark

20 Oct 2008, 8:57 AM
#4
philmoulds avatar

philmoulds

New Zenner

Join Date:
Mar 2008
Posts:
13
Plugin Contributions:
0

Re: Integrating Post Affilate Pro with Zen Cart

Hi Mark

Thanks for looking at this for me. I don't like to take 'issues' like this to public forums but had been told that your support team would not look into this any further for me without me paying for your integration service. I was adivsed to find a solution from the Zen Cart 'people' which of course means this forum. To be fair, your support team have always been very good also, but I did feel a little 'stranded' with this one!

I have used PAP before for a non Zen site and it is a great affiliate script, but I do think that your integration wizard should provide an installation that calculates commissions correctly. I'm sure you'll agree with that Mark. I have just had a reply from Martin who has said he will be looking into this.

I will of course happily recommend Post Affiliate Pro to all other Zen users if this can be fixed and your integration wizard instructions are updated - it is a great affiliate script!

Thanks again Mark, I look forward to getting things sorted for my site.

Phil

20 Oct 2008, 9:15 AM
#5
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Integrating Post Affilate Pro with Zen Cart

marosf:

I will not comment JROX, but if you check their integration with ZenCart you'll see they copied it from us, so they don't have any handling for discounts either.

Hmmmm...

According to my script, Dr Byte wrote the (original) integration code for JROX, and the streamlined updated version.

My integration code for JROX (Dr Byte's original) not only handles discounts, but also (with a small easy modification) Gift Certificates. The jury's still out on whether GV's should be deducted, as some people consider a GV to be a PRODUCT, rather than a CREDIT to someone's account. I hold the latter view.

Anyway Phil, if you decide to use JROX (still my recommendation) then here's the integration code for checkout_success/tpl_footer.php

##########################################

START JAM INTEGRATION WITH ZEN CART

ZC Integration code by DrByte 8/2006

##########################################
if ((int)$orders_id > 0) {
$JAM = $db->Execute("select class, value from " . TABLE_ORDERS_TOTAL . " where orders_id = '".(int)$orders_id."' AND class in ('ot_coupon', 'ot_gv', 'ot_subtotal', 'ot_group_pricing')");
while (!$JAM->EOF) {
switch ($JAM->fields['class']) {
case 'ot_subtotal':
$order_subtotal = $JAM->fields['value'];
break;
case 'ot_coupon':
$coupon_amount = $JAM->fields['value'];
break;
case 'ot_group_pricing':
$group_pricing_amount = $JAM->fields['value'];
break;
case 'ot_gv':
$gv_amount = $JAM->fields['value'];
break;
}
$JAM->MoveNext();
}
$commissionable_order = ($order_subtotal - $gv_amount - $coupon_amount - $group_pricing_amount);
$commissionable_order = number_format($commissionable_order,2,'.','');
echo "<script language="JavaScript" type="text/javascript" src="https://www.YOUR_WEBSITE/sale.php?amount=$commissionable_order&trans_id=$orders_id"></script>
#######################################

END JAM INTEGRATION WITH ZEN CART

#######################################

20 years a Zencart User

20 Oct 2008, 10:24 AM
#6
marosf avatar

marosf

New Zenner

Join Date:
Mar 2006
Posts:
2
Plugin Contributions:
0

Re: Integrating Post Affilate Pro with Zen Cart

Hi,

as you can see JROX and PAP do have very similar call of tracking code, and the same modification that is possible for JROX is possible for PAP too.
Below I'm posting an altered version of Dr Byte's or schoolboy's code for Post Affiliate Pro.

<? $dbreq = $db->Execute("select * from " . TABLE_ORDERS_TOTAL . " where orders_id = '".(int)$orders->fields['orders_id']."' AND class in ('ot_coupon', 'ot_gv', 'ot_subtotal', 'ot_group_pricing')"); while (!$dbreq->EOF) { switch ($dbreq->fields['class']) { case 'ot_subtotal': $order_subtotal = $dbreq->fields['value']; break; case 'ot_coupon': $coupon_amount = $dbreq->fields['value']; break; case 'ot_group_pricing': $group_pricing_amount = $dbreq->fields['value']; break; case 'ot_gv': $gv_amount = $dbreq->fields['value']; break; } $dbreq->MoveNext(); } $totalCost = ($order_subtotal - $gv_amount - $coupon_amount - $group_pricing_amount); $totalCost = number_format($totalCost,2,'.',''); $orderId = $dbreq->fields['orders_id']; print '<script id="pap_x2s6df8d" src="http://canvascrew.co.uk/go/scripts/sale.js" type="text/javascript"></script> <script type="text/javascript"> var TotalCost="'.$totalCost.'"; var OrderID="'.$orderId.'"; var ProductID=""; papSale(); </script>'; ?>

Surely in both PAP and JROX there are some nice features that the other system doesn't have, I'd like to point out to one thing where I'm sure PAP is better than JROX - it is tracking reliability.
PAP uses very advanced tracking technology. In addition to standard cookies to store referrals, PAP uses also Flash "cookies".
They are not that easy to be deleted by user, they don't get blocked by browsers, and they add few more percentage points towards the desirable 100% tracking reliability.

Better tracking reliability results in more properly tracked sales, less complaints from affiliates etc. etc.

20 Oct 2008, 11:02 AM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Integrating Post Affilate Pro with Zen Cart

Thanks for the updated code Mark.

Please keep in mind that advertising is not permitted on the forum. Let's not take this discussion into a battle between products.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

20 Oct 2008, 11:11 AM
#8
philmoulds avatar

philmoulds

New Zenner

Join Date:
Mar 2008
Posts:
13
Plugin Contributions:
0

Re: Integrating Post Affilate Pro with Zen Cart

Definitely agree with that DrByte

It's fair to say that Post Affilate Pro and JROX both appear to be great scripts - at the end of the day if this gets my site fixed I'm happy, and hopefully it will also benefit the PAP guys as they can update their installation guides.

Then any other Zen users can make their own minds up regarding their choice of affiliate script, but at least will have the confidence that either choice will install and work correctly :O)

I hadn't looked at JROX before - it does look very good also!

Thanks for peoples input to this, I really do appreciate it

Phil

21 Oct 2008, 1:02 PM
#9
philmoulds avatar

philmoulds

New Zenner

Join Date:
Mar 2008
Posts:
13
Plugin Contributions:
0

Re: Integrating Post Affilate Pro with Zen Cart

Just a quick update - this is now 100% fixed in Post Affiliate Pro with help from their support team

Maros added the above code into a 2nd file for me as well and this has ensured it works correctly:
includes/templates/aspphpdotnet/templates/tpl_checkout_success_default.php

I have just tested this and shipping fees are ignored and commission is awarded based on the discounted value - perfect!

Thanks again for the help to all who contributed, I really appreciate it :O)

Phil

22 Nov 2008, 12:30 PM
#10
dogtags avatar

dogtags

Totally Zenned

Join Date:
Nov 2003
Posts:
876
Plugin Contributions:
1

Re: Integrating Post Affilate Pro with Zen Cart

marosf:

Hi,

as you can see JROX and PAP do have very similar call of tracking code, and the same modification that is possible for JROX is possible for PAP too.
Below I'm posting an altered version of Dr Byte's or schoolboy's code for Post Affiliate Pro.

<? $dbreq = $db->Execute("select * from " . TABLE_ORDERS_TOTAL . " where orders_id = '".(int)$orders->fields['orders_id']."' AND class in ('ot_coupon', 'ot_gv', 'ot_subtotal', 'ot_group_pricing')"); while (!$dbreq->EOF) { switch ($dbreq->fields['class']) { case 'ot_subtotal': $order_subtotal = $dbreq->fields['value']; break; case 'ot_coupon': $coupon_amount = $dbreq->fields['value']; break; case 'ot_group_pricing': $group_pricing_amount = $dbreq->fields['value']; break; case 'ot_gv': $gv_amount = $dbreq->fields['value']; break; } $dbreq->MoveNext(); } $totalCost = ($order_subtotal - $gv_amount - $coupon_amount - $group_pricing_amount); $totalCost = number_format($totalCost,2,'.',''); $orderId = $dbreq->fields['orders_id']; print '<script id="pap_x2s6df8d" src="http://canvascrew.co.uk/go/scripts/sale.js" type="text/javascript"></script> <script type="text/javascript"> var TotalCost="'.$totalCost.'"; var OrderID="'.$orderId.'"; var ProductID=""; papSale(); </script>'; ?>

Thanks Mark :smile:

  1. Does this work in zencart 1.3.7.1 ?

  2. Is this placed just in .../templates/tpl_checkout_success_default.php ?

philmoulds:

Just a quick update - this is now 100% fixed in Post Affiliate Pro with help from their support team

Maros added the above code into a 2nd file for me as well and this has ensured it works correctly:
includes/templates/aspphpdotnet/templates/tpl_checkout_success_default.php

I have just tested this and shipping fees are ignored and commission is awarded based on the discounted value - perfect!

Thanks again for the help to all who contributed, I really appreciate it :O)

Phil

Thanks Phil :smile:

Which two files was the code placed in?

The only one I know of is .../templates/tpl_checkout_success_default.php


Super interested in getting this to all work with zen 1.3.7.1

Thanks Mark and Phil :smile: