How to setup CoreCommerce Affiliate Program



As its name suggests, CoreCommerce is an eCommerce software that is easy to use and offers an excellent experience on both mobile and desktop devices. CoreCommerce is all in one hosted shopping cart with FTP access, shared SSL and great support. CoreCommerce provides tools to help you design your eCommerce website, manage your inventory, create reports and more. CoreCommerce offers to secure your data with 256-bit SSL and fraud-protection which decreases the chance for credit card fraud.

Steps

Step 1 - Landing Page

Add following code before </body> in your landing page (i.e index.html or landing.html) if required
<script>
  var sd = 'YOUR-OSI-URL';
  var resource = document.createElement('script');
  resource.src = "YOUR-OSI-URL/track.js";  
  var script = document.getElementsByTagName('script')[0];
  script.parentNode.insertBefore(resource, script);
</script>


Change ‘YOUR-OSI-URL’ with your OSI URL.

Step 2 - Sale tracking

Open CoreCommerce file packages/core_commerce/single_pages/checkout/finish.php and search this line
if($previousOrder instanceof CoreCommercePreviousOrder && $previousOrder->getStatus() > 0) { ?>

Add following code below the mentioned line
<script async>
function hideIF() {    
        document.getElementById('IF').style.visibility = '';
}
function getSaleInfo() {
        document.getElementById('st_code').style.visibility = 'hidden';
        document.getElementById('st_code').innerHTML='<iframe src="YOUR-OSI-URL/sales/salejs/amount:<?php echo $previousOrder->getOrderTotal(); ?>/transaction:<?php echo $previousOrder->getOrderID(); ?>" alt="" id=IF width=50 height=50 border="0" frameborder="0" onload="hideIF()">';
}
window.onload = getSaleInfo;
</script>
<div id="st_code"></div>


Change ‘YOUR-OSI-URL’ with your OSI URL.