Zen Cart Logo
Forums / General Questions / New Jrox JAM integration code for 1.3.8

New Jrox JAM integration code for 1.3.8

Locked

Views: 4,113

Results 1 to 17 of 17
This thread is locked. New replies are disabled.
8 Feb 2008, 2:39 PM
#1
schoolboy avatar

schoolboy

Totally Zenned

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

New Jrox JAM integration code for 1.3.8

Just had word that Jrox JAM has obtained (via zencart chaps) the new integration code for 1.3.8.

------------------------
// bof JROX integration
if (isset($zv_orders_id) && (int)$zv_orders_id > 0 && isset($order_summary) && is_array($order_summary)) {
  if (!isset($_SESSION['affiliate_order_id']) || $_SESSION['affiliate_order_id'] != $zv_orders_id ) {
      $_SESSION['affiliate_order_id'] = $zv_orders_id;
     $commissionable_order_formatted = number_format($order_summary['commissionable_order'], 2, '.', '');
     echo '<script language="javascript" type="text/javascript" src="http://www.yourdomain.com/affiliates/sale.php?amount=' . $commissionable_order_formatted . '&trans_id=' . $order_summary['order_number'] . '"></script>';
    }
}
// eof JROX integration
-------------------------

My questions are:-

  1. Does this code perform the same calculation(s) as the old footer integration code - particularly with regard to deducting discounts from the sub total. Here is the relevant line in the old code:-
  $commissionable_order = ($order_subtotal - $coupon_amount - $group_pricing_amount);
  1. And is it possible to ALSO subtract Gift Certificate amount, which a few of us think is vital to the correct calculation of affiliate commissions:-
$commissionable_order = ($order_subtotal - $gv_amount - $coupon_amount - $group_pricing_amount);

If the NEW code can't do (2) above, is it still okay to use the old code?

8 Feb 2008, 2:41 PM
#2
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: New Jrox JAM integration code for 1.3.8

Wouldnt it be better to contact JAM directly? Since this is THEIR code.

8 Feb 2008, 2:43 PM
#3
schoolboy avatar

schoolboy

Totally Zenned

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

Re: New Jrox JAM integration code for 1.3.8

I've spent most of the morning in the JAM forum asking the same question.

Here's their Forum Admin response:-

**this is code given to us directly from the folks over at zencart.

you are welcome to change it, however you see fit.**

8 Feb 2008, 3:47 PM
#4
drbyte avatar

drbyte

Sensei

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

Re: New Jrox JAM integration code for 1.3.8

schoolboy:

My questions are:-

  1. Does this code perform the same calculation(s) as the old footer integration code - particularly with regard to deducting discounts from the sub total. Here is the relevant line in the old code:-

$commissionable_order = ($order_subtotal - $coupon_amount - $group_pricing_amount);

> 
> 2. And is it possible to ALSO subtract Gift Certificate amount, which a few of us think is vital to the correct calculation of affiliate commissions:-
> 
> ```php
$commissionable_order = ($order_subtotal - $gv_amount - $coupon_amount - $group_pricing_amount);

If the NEW code can't do (2) above, is it still okay to use the old code?

The "new" code is based on making use of the code in the bottom of /includes/modules/YOUR_TEMPLATE/checkout_process.php

Specific to your questions:

  1. is built-in, as described
  2. Gift Certificate amounts are automatically deducted, since they are handled by a credit-class OT module.
    However, if needed, you can customize as desired, using an override of checkout_process.php
  3. Yes, if you don't like the new code, you can use the old code; however, you're using more SQL queries and CPU cycles needlessly.
8 Feb 2008, 4:17 PM
#5
schoolboy avatar

schoolboy

Totally Zenned

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

Re: New Jrox JAM integration code for 1.3.8

Thanks a ton doc... I'll stick with the old code for now. Next month I'll put up a test site to see how the new footer code performs!

17 Feb 2008, 1:47 AM
#6
kadesign avatar

kadesign

Totally Zenned

Join Date:
Feb 2005
Location:
New Jersey
Posts:
593
Plugin Contributions:
0

Re: New Jrox JAM integration code for 1.3.8

Hi,
I also have a question concerning Jam. I added the following code to the bottom of my tpl_footer. Is this correct? They do state the code is provided by ZenCart. I am using 1.3.8 but now I am noticing an issue during check out since adding the code. At the last stage of checkout, confirm order, I am getting a warming that the page contains secure and unsecure items. Is this possibly due to the code?

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

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_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;
}
$JAM->MoveNext();
}
$commissionable_order = ($order_subtotal - $coupon_amount - $group_pricing_amount);
$commissionable_order = number_format($commissionable_order,2,'.','');
echo "<script language="JavaScript" type="text/javascript" src="http://www.mydomain.com/affiliates/sale.php?amount=$commissionable_order&trans_id=$orders_id"></script></td></tr>

</table>"; } ####################################### ## END JAM INTEGRATION WITH ZEN CART ## #######################################

Thanks,
Kelly

17 Feb 2008, 2:26 AM
#7
kadesign avatar

kadesign

Totally Zenned

Join Date:
Feb 2005
Location:
New Jersey
Posts:
593
Plugin Contributions:
0

Re: New Jrox JAM integration code for 1.3.8

It was it...
I just changed the src="http://www.mydomain.com/affiliates/sale.php?
to src="https://www.mydomain.com/affiliates/sale.php?
I seems to have fixed the problem...I hope!

Thanks,
Kelly

18 Feb 2008, 11:18 AM
#8
schoolboy avatar

schoolboy

Totally Zenned

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

Re: New Jrox JAM integration code for 1.3.8

If changing the "http" to "https" results in no errors, then what you have done should be OK.

18 Feb 2008, 8:05 PM
#9
website_rob avatar

website_rob

Inactive

Join Date:
Oct 2006
Location:
Alberta, Canada
Posts:
4,572
Plugin Contributions:
0

Re: New Jrox JAM integration code for 1.3.8

Another option is to change:

from
src="http://www.mydomain.com/affiliates/sale.php?

to
src="/affiliates/sale.php?

That allows your Browser to decide if using an 'https' or 'http' connection.

You only need to use a full URL (includes the Domain name) when the link is to another site. Then you have to decide if 'https' or 'http' is to be used.

18 Feb 2008, 8:58 PM
#10
kadesign avatar

kadesign

Totally Zenned

Join Date:
Feb 2005
Location:
New Jersey
Posts:
593
Plugin Contributions:
0

Re: New Jrox JAM integration code for 1.3.8

Thanks Rob!! I think that is a much better idea. :smile:

18 Feb 2008, 9:17 PM
#11
kadesign avatar

kadesign

Totally Zenned

Join Date:
Feb 2005
Location:
New Jersey
Posts:
593
Plugin Contributions:
0

Re: New Jrox JAM integration code for 1.3.8

I have another question. I have a java code script in a sidebox to show the person that sent you to my site. If they are an affiliate or demostrator. I had to change the path on that as well. But anyway...I think it is really slowing down my site when someone goes through check out. Is that to be expected?
Here is my "affiliate" link. Please be aware the site sells lingerie and toys.

http://anniej.sleeplessnightsonline.com/

Thanks,
Kelly

19 Feb 2008, 8:20 AM
#12
schoolboy avatar

schoolboy

Totally Zenned

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

Re: New Jrox JAM integration code for 1.3.8

...careful, you will need the full path if your Affiliate Software resides on a different URL, or in a sub-directory.

9 Apr 2009, 6:54 AM
#13
bumba000 avatar

bumba000

Totally Zenned

Join Date:
Feb 2007
Location:
Pennsylvania
Posts:
856
Plugin Contributions:
0

Re: New Jrox JAM integration code for 1.3.8

Hi All,
I'm using the footer code that schoolboy has put up for 1.3.8. We're running 1.3.8a. Jam is recording the number of hits an affiliate gets. Emails are also being generated when a sale is finalized but there is no commission generated in the admin or in the affiliates account.

There are no errors in the footer on checkout_success. I have this overridden properly. Does this sound like some admin config mistake on my part?

Thanks,
John

9 Apr 2009, 2:40 PM
#14
bumba000 avatar

bumba000

Totally Zenned

Join Date:
Feb 2007
Location:
Pennsylvania
Posts:
856
Plugin Contributions:
0

Re: New Jrox JAM integration code for 1.3.8

Okay, I did go over everything again today. I did notice that I had created a "Program", set the commission rate and all that. I never went and set the affiliate as a part of that program. I have done it now and I still have no commissions being tracked in the DB.

Emails are still sent out saying that a commission was generated for xxx order for xxx dollars but there is nothing reflecting that in the admin or in the affiliates account.

The lower part of my tpl_footer looks like this

<!--eof-ip address display -->   

<?php

// bof JROX integration
if (isset($zv_orders_id) && (int)$zv_orders_id > 0 && isset($order_summary) && is_array($order_summary)) {
  if (!isset($_SESSION['affiliate_order_id']) || $_SESSION['affiliate_order_id'] != $zv_orders_id ) {
      $_SESSION['affiliate_order_id'] = $zv_orders_id;
     $commissionable_order_formatted = number_format($order_summary['commissionable_order'], 2, '.', '');
     echo '<script language="javascript" type="text/javascript" src="/affiliates/sale.php?amount=' . $commissionable_order_formatted . '&trans_id=' . $order_summary['order_number'] . '"></script>';
    }
}
// eof JROX integration 



} // flag_disable_footer

if (ZEN_CONFIG_USER_TRACKING == 'true') { zen_update_user_tracking(); } ?>

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-5115033-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
</div>
```Is the .htaccess code supposed to be added to my public_html/.htaccess or should the JROX .htaccess be in the affiliates dir?

Would the .htaccess be causing the problem that I'm having?

Thank you,
                 John
9 Apr 2009, 2:46 PM
#15
bumba000 avatar

bumba000

Totally Zenned

Join Date:
Feb 2007
Location:
Pennsylvania
Posts:
856
Plugin Contributions:
0

Re: New Jrox JAM integration code for 1.3.8

In Addition. . .

the JROX DB Table > jx_commissions is being written to. There are 8 records in this table. All have the correct info but the "Referrer" is "Unknown" for each of them.

9 Apr 2009, 3:01 PM
#16
bumba000 avatar

bumba000

Totally Zenned

Join Date:
Feb 2007
Location:
Pennsylvania
Posts:
856
Plugin Contributions:
0

Re: New Jrox JAM integration code for 1.3.8

I guess sometimes it just helps to talk it out, even if its with yourself. :smile:

Having the busted <script> tags in the DB hosed it all up. On top of that I didn't know that I had to go to Commissions in the admin and approve or deny the commissions that were listed there.

When I first saw them they were clearly be broken by the script tags.

Thanks for the help <not being snarky> ,
John:clap:

4 Aug 2009, 12:07 PM
#17
helpme avatar

helpme

Totally Zenned

Join Date:
Apr 2007
Posts:
632
Plugin Contributions:
0

Re: New Jrox JAM integration code for 1.3.8

I am having the same problem, I have everything set up commisions, programs, etc but when I create an order, it counts the link but does not generate the commission.
it doesn't look like my commissions db is being written to.
any ideas?