–Hidden comment

Use attributes in format region_from and region_to= to change the languages showing in language switcher.
Available regions are:
europe_from europe_to
asia_from asia_to
mideast_from mideast_to
america_from america_to

europe_from=0 europe_to=22 will put all languages (ordered in language switcher settings) from 1 to 21 to Europe region:
asia_from=22 asia_to=25 will put all languages from 23 to 24 (so only 2) into Asia region.

Virtue Mart

A free e-commerce solution.

Integration with Virtue Mart is made by placing sale tracking script into the confirmation page.

Edit template

Find and open file checkout.thankyou.php.

It should be in ‘administrator/components/com_virtuemart/html/‘.


Replace last:


with following code:

 $q = "SELECT * FROM #__{vm}_user_info WHERE user_id='$user_id'";
 $db->query( $q );
 $pap_user_email = $db->f('user_email');

 $q = "SELECT * FROM #__{vm}_orders WHERE order_id='$order_id'";
 $db->query( $q );
 $pap_order_subtotal = $db->f('order_subtotal' );
 $pap_coupon_code = $db->f("coupon_code");
 $pap_coupon_discount = $db->f("coupon_discount");
 if (!is_null($pap_coupon_discount) && $pap_coupon_discount != '') {
   $pap_order_total =  $pap_order_subtotal - $pap_coupon_discount;
 } else {
   $pap_order_total =  $pap_order_subtotal;

 $q = "SELECT * FROM #__{vm}_order_item WHERE order_id='$order_id'";
 $db->query( $q );
 $pap_product_id = $db->f('product_id');
<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
<script type="text/javascript">PostAffTracker.setAccountId('Account_ID');var sale = PostAffTracker.createSale();
sale.setTotalCost('<?php echo $pap_order_total ?>');
sale.setOrderID('<?php echo $order_id ?>');
sale.setProductID('<?php echo $pap_product_id ?>');
sale.setData1('<?php echo $pap_user_email ?>');
sale.setCoupon('<?php echo $pap_coupon_code ?>');

This code will track subtotal of the price (with coupon discount). If you want to track something else, you can use one of this variables:
order_total, order_subtotal, order_tax, order_shipping, order_shipping_tax, coupon_discount, order_discount, order_status, customer_note

Use it in the way as it is showed in the code above in the third line.

Separated products

There is also possibility to generate unique transaction in PAP for every product type. With this you will have ability to edit separate product types within one order. It is useful if any refund occur. Then you will decline just one transaction (commission) assigned to product type that was refunded.

In this case please use this integration code instead of code above:

 $q = "SELECT * FROM #__{vm}_user_info WHERE user_id='$user_id'";
 $db->query( $q );
 $pap_user_email = $db->f('user_email');

 $q = "SELECT * FROM `#__{vm}_orders` WHERE `order_id`='$order_id'";
 $db->query( $q );
 $pap_coupon_code = $db->f('coupon_code');
 $pap_coupon_discount = $db->f('coupon_discount');
 $pap_order_subtotal = $db->f('order_subtotal');

 $q = "SELECT * FROM #__{vm}_order_item WHERE order_id='$order_id'";
 $number_of_items = @ mysql_fetch_array ($q);
 $db->query( $q );
 while ($db->next_record()) {
  $pap_product_id[$i] = $db->f('product_id');
  $pap_item_price[$i] = $db->f('product_final_price');
  $pap_item_quantity[$i] = $db->f('product_quantity');
 <script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
 <script type="text/javascript">
 for ($j=0; $j<=$i; $j++){
  $pap_final_price[$j] = ($pap_order_subtotal - $pap_coupon_discount) * $pap_item_price[$j] * $pap_item_quantity[$j] / $pap_order_subtotal;
  echo "var sale".$j." = PostAffTracker.createSale();\n".
       "sale".$j.".setTotalCost('". $pap_final_price[$j]."');\n".

If you want to see name of item instead of number of item use variable ‘order_item_name‘ instead of ‘product_id‘ in this line:

$pap_product_id[$i] = $d


It is now integrated. Every time customer enters the order confirmationpage the tracking code is called and it will register a sale forreferring affiliate.

Version 1.4

It seems like the version 1.4 needs edit of other file – checkout.result.php

It is a suggestion from one of our customers, we didn’t test it.

Virtue Mart with PayPal

In case you are using VirtueMart with PayPal in your Joomla, you have to do some special steps to make integration working.

First, in administrator/components/com_virtuemart/notify.php (at your server) add lines below line with code: if ($_POST) {

/* PAP integration */
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://URL_TO_PostAffiliatePro/plugins/PayPal/paypal.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST);
/* end of PAP integration */

Now save the file and login to your Joomla.

VirtueMart with PayPal

Navigate to Components> VirtueMart> Store> List Payment Methods> PayPal> Configuration> Payment Extra Info and add on of these lines:

"custom" => 'Account_ID'$_COOKIE['PAPVisitorId'], // for version of PAP 4.4.x.x and higher

or (depending on your PAP version):

"custom" => $_COOKIE['PAPCookie_Sale'], // for version of PAP 4.3.x.x and lower

Insert it below line with “notify_url”=>…

Back to Integrations Create account for FREE

Our website uses cookies. By continuing we assume your permission to deploy cookies as detailed in our privacy and cookies policy.


Schedule a one-on-one call and discover how Post Affiliate Pro can benefit your business.

We’re available on multiple dates

Schedule a call