How to set up an Avactis Integration Affiliate Program 


Avactis is ecommerce solutions that allows you to open an online store on the Internet. It’s the best bet for Magento based ecommerce services. Avactis Shopping Cart has two parts, a client side and an administrator side. Avactis has been a popular choice for businesses including but not limited to clothes, food, footwear and more.

Steps

Step 1 - Click Tracking

Go to “Page manager”. Select a page where you want to integration. Click edit at the bottom “Copyright” section. Add the following code in “Block content”
<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

Go to “Page manager” and select “order_placed.php” and click edit. Find “Last Placed Order” section and add following code just before “?>”
<?php
$order_id = modApiFunc("Checkout", "getLastPlacedOrderID");
if(!empty($order_id)) {
$orderInfo = modApiFunc("Checkout", "getOrderInfo", $order_id, modApiFunc("Localization", "whichCurrencySendOrderToPaymentShippingGatewayIn", $order_id, GET_PAYMENT_MODULE_FROM_ORDER));
$grand_total = 0;
foreach($orderInfo['Products'] as $product_info)
$grand_total += $product_info['SalePrice'] * $product_info['qty'];
?>
<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 $grand_total; ?>/transaction:<?php echo $order_id; ?>" alt="" id=IF width=50 height=50 border="0" frameborder="0" onload="hideIF()">';
}
window.onload = getSaleInfo;
</script>
<div id="st_code"></div>
<?php
}

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