Affiliate Software Documentation
Commission Integration with ZenCart
To integrate the affiliate software with your Zencart shopping cart, follow these steps:
- Create a tpl_footer.php override file if you do not yet have one.
- For a new file, you can copy the following code into your tpl_footer.php
<?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 INTEGRATION WITH ZEN CART ## ########################################## if ((int)$orders_id > 0) { $AFF = $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 (!$AFF->EOF) { switch ($AFF->fields['class']) { case 'ot_subtotal': $order_subtotal = $AFF->fields['value']; break; case 'ot_coupon': $coupon_amount = $AFF->fields['value']; break; case 'ot_group_pricing': $group_pricing_amount = $AFF->fields['value']; break; } $AFF->MoveNext(); } $commissionable_order = ($order_subtotal - $coupon_amount - $group_pricing_amount); $commissionable_order = number_format($commissionable_order,2,'.',''); if ($commissionable_order < '0.01') { //try paypal $aff = $db->Execute("select * FROM " . TABLE_PAYPAL . " where order_id = '".(int)$orders_id."'"); if (!$aff) { $commissionable_order = $AFF->fields['mc_gross']; } } echo "<script language=\"JavaScript\" type=\"text/javascript\" src=\"http://www.yourdomain.com/affiliates/sale/amount/$commissionable_order/trans_id/$orders_id\"></script>"; } ####################################### ## END INTEGRATION WITH ZEN CART ## ####################################### ?>
- If you already have a custom tpl_footer.php override file, you can copy the lines in the code to add to your file:
- Scroll to the lines that have the affiliate integration and change the URL path to reflect your correct your affiliate installation URL:
echo "<script language="\"JavaScript\"" type="\"text/javascript\"" src="\"http://www.yourdomain.com/affiliates/sale/amount/$commissionable_order/trans_id/$orders_id\""></script>";
- Save it, and upload it to /includes/templates/THEME_NAME/checkout_success. If there is no checkout_success folder there, just create one.
- If you are using SSL on your Zencart check-out site, make sure to change the src URL of the affiliate system to use https:// instead of http://