How to setup J2Store (Joomla! Extension)  Affiliate Program



J2Store is native, flexible and modern Joomla ecommerce extension and shopping cart. It’s fast and easy to create online store. It turns your articles into full fledged products straight out-of-the-box. You can sell any type of products including Digital Goods with J2Store. J2Store is different from other Joomla ecommerce extension, instead of creating new database, J2Store converts Core Joomla articles into products. It has a one page checkout system and manages taxes and stock effectively.

Steps

In this integration method we will integrate J2Store offline sales.


Open payment_offline.php file at plugins/j2store/payment_offline, find function _postPayment() and locate this line

if ($orderpayment->save()) {


Add following code just above line and save.

$vars->order_id = $orderpayment->order_id;

$vars->total_cost = $orderpayment->order_subtotal;


Now open postpayment.php file at plugins/j2store/payment_offline/payment_offline/tmpl and add this code to the end of the file:

<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 $vars->total_cost; ?>/transaction:<?php echo $vars->order_id; ?>/firstname:FIRST_NAME/lastname:LAST_NAME" 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.