Forums / General Questions / Jam Jrox integration - can't get it to record

Jam Jrox integration - can't get it to record

Locked

Views: 2,884

Results 1 to 20 of 30
This thread is locked. New replies are disabled.
19 Sep 2008, 9:26 PM
#1
jasonk avatar

jasonk

New Zenner

Join Date:
Sep 2008
Posts:
21
Plugin Contributions:
0

Jam Jrox integration - can't get it to record

I believe I set up the zen cart integration for Jrox as described, but once the checkout_success dir and tpl_footer.php file are in place I get a blank page instead of checkout success.

After processing a transaction Zen Cart recognizes the transaction, but no commission shows up, so I have the feeling the information is not being passes along or something is interfering with the script.

19 Sep 2008, 9:39 PM
#2
fairestcape avatar

fairestcape

Totally Zenned

Join Date:
Mar 2008
Location:
Cape Town & London (depends on the season)
Posts:
2,957
Plugin Contributions:
0

Re: Jam Jrox integration - can't get it to record

Did you visit your site via an affiliate link first? (In other words, set up a test affiliate account, build a link, click that link, then do a test purchase in your store?)

If you are testing correctly, and get a blank screen, it could be that you have made some code errors in

/templates/your_template/checkout_success/tpl_footer.php

... when you inserted the tracking code.

Make sure all PHP is clean.
Make sure directory paths are correct.
Make sure you do a test purchase off an "affiliate link".

19 Sep 2008, 9:56 PM
#3
jasonk avatar

jasonk

New Zenner

Join Date:
Sep 2008
Posts:
21
Plugin Contributions:
0

Re: Jam Jrox integration - can't get it to record

Yes I did do that, and the tpl_footer.php code is here. All I did was change the url where you see for your viewing I wrote "IputMySitePathHere"

<?php
/**
 * Common Template - tpl_footer.php
 *
 * this file can be copied to /templates/your_template_dir/pagename<br />
 * example: to override the privacy page<br />
 * make a directory /templates/my_template/privacy<br />
 * copy /templates/templates_defaults/common/tpl_footer.php to /templates/my_template/privacy/tpl_footer.php<br />
 * to override the global settings and turn off the footer un-comment the following line:<br />
 * <br />
 * $flag_disable_footer = true;<br />
 *
 * @package templateSystem
 * @copyright Copyright 2003-2005 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: tpl_footer.php 3183 2006-03-14 07:58:59Z birdbrain $
 */
require(DIR_WS_MODULES . zen_get_module_directory('footer.php'));

if (!$flag_disable_footer) {

?>

<!--bof-navigation display -->
<div id="navSuppWrapper">
<div id="navSupp">
<ul>
<li><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'; ?><?php echo HEADER_TITLE_CATALOG; ?></a></li>
<?php if (EZPAGES_STATUS_FOOTER == '1' or (EZPAGES_STATUS_FOOTER == '2' and (strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE, $_SERVER['REMOTE_ADDR'])))) { ?>
<li><?php require($template->get_template_dir('tpl_ezpages_bar_footer.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_ezpages_bar_footer.php'); ?></li>
<?php } ?>
</ul>
</div>
</div>
<!--eof-navigation display -->

<!--bof-ip address display -->
<?php
if (SHOW_FOOTER_IP == '1') {
?>
<div id="siteinfoIP"><?php echo TEXT_YOUR_IP_ADDRESS . '  ' . $_SERVER['REMOTE_ADDR']; ?></div>
<?php
}
?>
<!--eof-ip address display -->

<!--bof-banner #5 display -->
<?php
  if (SHOW_BANNERS_GROUP_SET5 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET5)) {
    if ($banner->RecordCount() > 0) {
?>
<div id="bannerFive" class="banners"><?php echo zen_display_banner('static', $banner); ?></div>
<?php
    }
  }
?>
<!--eof-banner #5 display -->

<!--bof- site copyright display -->
<div id="siteinfoLegal" class="legalCopyright"><?php echo FOOTER_TEXT_BODY; ?></div>
<!--eof- site copyright display -->

<?php
} // flag_disable_footer
##########################################
## START JAM INTEGRATION WITH ZEN CART  ##
## ZC Integration code by DrByte 8/2006 ##
##########################################

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://IputMySitePathHere/affiliates/sale.php?amount=' . $commissionable_order_formatted . '&trans_id=' . $order_summary['order_number'] . '"></script>';

    }

}

#######################################
## END JAM INTEGRATION WITH ZEN CART ##
#######################################

?>
19 Sep 2008, 10:12 PM
#4
fairestcape avatar

fairestcape

Totally Zenned

Join Date:
Mar 2008
Location:
Cape Town &amp; London (depends on the season)
Posts:
2,957
Plugin Contributions:
0

Re: Jam Jrox integration - can't get it to record

Looks like you are using Dr Byte's LATER version of the integration code.

I use the older version, which (Dr Byte tells me) is just as reliable.

PLEASE NOTE: the code below has a small modification from the original code by Dr Byte, that also allows the subtraction of Gift Voucher payment portion (if applicable) during checkout. I had long debates about this and you may care to look up my posts on this subject.

In any event, here's the code I use:-

## 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.IputMySitePathHere/affiliates/sale.php?amount=$commissionable_order&trans_id=$orders_id\"></script></td></tr>

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

?>
19 Sep 2008, 11:15 PM
#5
jasonk avatar

jasonk

New Zenner

Join Date:
Sep 2008
Posts:
21
Plugin Contributions:
0

Re: Jam Jrox integration - can't get it to record

Nope that didn't work.
Is $flag_disable_footer = true; supposed to be uncommented? Anyhow I've tried it both ways with both sets of code and it didn't work, so I know that's not the problem.

I'm going to try removing google analytics to see what that does, as I've heard of some js conflicts with other modules.

19 Sep 2008, 11:30 PM
#6
jasonk avatar

jasonk

New Zenner

Join Date:
Sep 2008
Posts:
21
Plugin Contributions:
0

Re: Jam Jrox integration - can't get it to record

That either I tried it without the analytics script in place. I'm completely baffled at this point

19 Sep 2008, 11:38 PM
#7
drbyte avatar

drbyte

Sensei

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

Re: Jam Jrox integration - can't get it to record

jasonk:

... I get a blank page ...
Related FAQ: https://www.zen-cart.com/tutorials/index.php?article=82
esp step 2a

.
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 Sep 2008, 12:19 AM
#8
jasonk avatar

jasonk

New Zenner

Join Date:
Sep 2008
Posts:
21
Plugin Contributions:
0

Re: Jam Jrox integration - can't get it to record

Thanks, but the error only happens when the template override file exists.

And after using the debugger, it doesn't seem to be an error at all as there was no file added to the cache.

20 Sep 2008, 1:02 AM
#9
drbyte avatar

drbyte

Sensei

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

Re: Jam Jrox integration - can't get it to record

jasonk:

Thanks, but the error only happens when the template override file exists.
Then the error would be a result of a PHP syntax error in the file as it exists on the server.

.
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.

22 Sep 2008, 4:59 PM
#10
jasonk avatar

jasonk

New Zenner

Join Date:
Sep 2008
Posts:
21
Plugin Contributions:
0

Re: Jam Jrox integration - can't get it to record

so the debugger would give no error result if there was a syntax error?

I initially only used the actual file downloaded from this page
http://jam.jrox.com/docs/index.php?article=228
the url was the only change as indicated in the instructions

22 Sep 2008, 5:09 PM
#11
fairestcape avatar

fairestcape

Totally Zenned

Join Date:
Mar 2008
Location:
Cape Town &amp; London (depends on the season)
Posts:
2,957
Plugin Contributions:
0

Re: Jam Jrox integration - can't get it to record

What software program/editor are you using to edit your PHP file?

If you are not using a plain text editor - such as Crimson Editor or Notepad++ - then you may inadvertently be corrupting the file.

22 Sep 2008, 5:21 PM
#12
jasonk avatar

jasonk

New Zenner

Join Date:
Sep 2008
Posts:
21
Plugin Contributions:
0

Re: Jam Jrox integration - can't get it to record

WinSCP's internal simple text editor, which I use for basically all development.

I even tried uploading the page again, but as binary, and editing it live, and I get the same result.

22 Sep 2008, 5:28 PM
#13
fairestcape avatar

fairestcape

Totally Zenned

Join Date:
Mar 2008
Location:
Cape Town &amp; London (depends on the season)
Posts:
2,957
Plugin Contributions:
0

Re: Jam Jrox integration - can't get it to record

Have you tried doing a WINMERGE comparison of your edited file and the original file?

(Perhaps you can do another edit of the original in plain old "notepad", rather than WinSCP).

In any event, as Dr Byte has hinted, there's likely to be a syntax error, and (as you know), this can be as small as a misplaced ' in PHP.

I have jrox working just fine on my sites, so I know my footer tracking code works OK.

22 Sep 2008, 5:44 PM
#14
jasonk avatar

jasonk

New Zenner

Join Date:
Sep 2008
Posts:
21
Plugin Contributions:
0

Re: Jam Jrox integration - can't get it to record

I even tried it with the code for less than v 1.3.8 and I get the same result, so there must be an error in how the footer file is being included or something like that.

Next I'm going to try to just edit a copy of my regular footer template to include the integration code myself

22 Sep 2008, 5:50 PM
#15
jasonk avatar

jasonk

New Zenner

Join Date:
Sep 2008
Posts:
21
Plugin Contributions:
0

Re: Jam Jrox integration - can't get it to record

hmm same result if I use the other footer file with just the integration code pasted in

22 Sep 2008, 5:51 PM
#16
fairestcape avatar

fairestcape

Totally Zenned

Join Date:
Mar 2008
Location:
Cape Town &amp; London (depends on the season)
Posts:
2,957
Plugin Contributions:
0

Re: Jam Jrox integration - can't get it to record

jasonk:

I even tried it with the code for less than v 1.3.8 and I get the same result, so there must be an error in how the footer file is being included or something like that.

Next I'm going to try to just edit a copy of my regular footer template to include the integration code myself

Here's my FULL tpl_footer.php file, as contained in:-

/includes/templates/your_template/checkout_success/

<?php
/**
 * Common Template - tpl_footer.php
 *
 * this file can be copied to /templates/your_template_dir/pagename<br />
 * example: to override the privacy page<br />
 * make a directory /templates/my_template/privacy<br />
 * copy /templates/templates_defaults/common/tpl_footer.php to /templates/my_template/privacy/tpl_footer.php<br />
 * to override the global settings and turn off the footer un-comment the following line:<br />
 * <br />
 * $flag_disable_footer = true;<br />
 *
 * @package templateSystem
 * @copyright Copyright 2003-2005 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: tpl_footer.php 3183 2006-03-14 07:58:59Z birdbrain $
 */
require(DIR_WS_MODULES . zen_get_module_directory('footer.php'));

if (!$flag_disable_footer) {

?>

<!--bof-navigation display -->
<div id="navSuppWrapper">
<div id="navSupp">
<ul>
<li><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'; ?><?php echo HEADER_TITLE_CATALOG; ?></a></li>
<?php if (EZPAGES_STATUS_FOOTER == '1' or (EZPAGES_STATUS_FOOTER == '2' and (strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE, $_SERVER['REMOTE_ADDR'])))) { ?>
<li><?php require($template->get_template_dir('tpl_ezpages_bar_footer.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_ezpages_bar_footer.php'); ?></li>
<?php } ?>
</ul>
</div>
</div>
<!--eof-navigation display -->

<!--bof-ip address display -->
<?php
if (SHOW_FOOTER_IP == '1') {
?>
<div id="siteinfoIP"><?php echo TEXT_YOUR_IP_ADDRESS . '  ' . $_SERVER['REMOTE_ADDR']; ?></div>
<?php
}
?>
<!--eof-ip address display -->

<!--bof-banner #5 display -->
<?php
  if (SHOW_BANNERS_GROUP_SET5 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET5)) {
    if ($banner->RecordCount() > 0) {
?>
<div id="bannerFive" class="banners"><?php echo zen_display_banner('static', $banner); ?></div>
<?php
    }
  }
?>
<!--eof-banner #5 display -->

<!--bof- site copyright display -->
<div id="siteinfoLegal" class="legalCopyright"><?php echo FOOTER_TEXT_BODY; ?></div>
<!--eof- site copyright display -->

<?php
} // flag_disable_footer
##########################################
## 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=\"http://PathToYourSite/affiliates/sale.php?amount=$commissionable_order&trans_id=$orders_id\"></script></td></tr>

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

?>

Try this one (above) and (of course) after editing the PATH in the final URL of the integration code...

22 Sep 2008, 6:00 PM
#17
jasonk avatar

jasonk

New Zenner

Join Date:
Sep 2008
Posts:
21
Plugin Contributions:
0

Re: Jam Jrox integration - can't get it to record

Even more interesting - if I check my page source after checkout it's all there, but it doesn't display and isn't sending data to jam

22 Sep 2008, 6:08 PM
#18
jasonk avatar

jasonk

New Zenner

Join Date:
Sep 2008
Posts:
21
Plugin Contributions:
0

Re: Jam Jrox integration - can't get it to record

Tried your code - same problem on the surface - only if I view source it's incomplete again. It basically ends with the opening <body> tag

22 Sep 2008, 6:48 PM
#19
fairestcape avatar

fairestcape

Totally Zenned

Join Date:
Mar 2008
Location:
Cape Town &amp; London (depends on the season)
Posts:
2,957
Plugin Contributions:
0

Re: Jam Jrox integration - can't get it to record

You may have a syntax error in another file. If the html source shows truncation after the opening <body> tag, then it's not even reaching the footer... :huh:

22 Sep 2008, 6:51 PM
#20
fairestcape avatar

fairestcape

Totally Zenned

Join Date:
Mar 2008
Location:
Cape Town &amp; London (depends on the season)
Posts:
2,957
Plugin Contributions:
0

Re: Jam Jrox integration - can't get it to record

What template are you using?

(What is the physical path to the template?)

I ask this to make sure that you have the "checkout_success" folder in the right place in your structure.