Virtue Mart 2

Integrate Post Affiliate Pro with Virtue Mart 2 in Joomla for tracking sales via PayPal, COD, Cheque, and GoogleCheckout. Modify specific files and add JavaScript and cURL code to enable seamless tracking.

Virtue Mart 2

Virtue Mart 2 integration

A free e-commerce solution.

This integration method is for Virtue Mart version 2. If you have lower version, please navigate to the integration method named “Virtue Mart”.

Virtue Mart with PayPal in Joomla

First step is to edit file /plugins/vmpayment/paypal/paypal.php of your Joomla installation.

Find function ***plgVmConfirmedOrder($cart, $order)*** and in the function find line:

$html.= '</form>';

It can also be like this:

$html .= '</form></div>';

Now add this code right after the above:

$html.= '<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
<script type="text/javascript">'."
PostAffTracker.setAccountId('Account_ID');
PostAffTracker.setAppendValuesToField('&pap_custom=');
PostAffTracker.writeCookieToCustomField('pap_ab78y5t4a');
</script>";

Virtue Mart with PayPal in Joomla

Now one more change is needed – find the line:

$html.= '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($value) . '" />';

and replace it with this:

if ($name == "notify_url") {$id='id="pap_ab78y5t4a"';} else {$id="";}
$html.= '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($value) . '" '.$id." />\n";

Now save your work, there is another step to be done.

Virtue Mart with PayPal in Joomla

Final step is to resend response from PayPal to Post Affiliate Pro . To do this, find this line in the same file: _function *processIPN($paypal_data, $method) {***

Add this code right below this line (create a new blank line) and past the code there:

// [Post Affiliate](https://www.postaffiliatepro.com/ "Post Affiliate Pro offers a comprehensive affiliate software platform to manage multiple affiliate programs with ease. Enjoy no setup fees, 24/7 customer support, and a free 1-month trial. Ideal for small and large businesses, it features precise tracking, automated workflows, and customizable tools to boost your affiliate marketing success. Try it now and streamline your affiliate operations effortlessly!") Pro integration snippet
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://URL_TO_PostAffiliatePro/plugins/PayPal/paypal.php?pap_custom=".$_GET['pap_custom']);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST);
curl_exec($ch);
// /Post Affiliate Pro integration snippet

This is it. Now save your file and upload it back to the server. Do not forget to ***enable PayPal plugin*** in your Post Affiliate Pro.

Virtue Mart with COD in Joomla

In case of Cash on delivery (COD) you have to modify the file /plugins/vmpayment/standard/standard.php and insert the sale tracking code there.

Find the line: ***$cart- >emptyCart ();***

and paste this code above that line:

$html.= '<!-- Post [Affiliate](https://www.postaffiliatepro.com/ "Post Affiliate Pro offers a comprehensive affiliate software platform to manage multiple affiliate programs with ease. Enjoy no setup fees, 24/7 customer support, and a free 1-month trial. Ideal for small and large businesses, it features precise tracking, automated workflows, and customizable tools to boost your affiliate marketing success. Try it now and streamline your affiliate operations effortlessly!") Pro sale tracking code -->
<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(\''.$order['details']['BT']->order_subtotal.'\');
sale.setOrderID(\''.$order['details']['BT']->order_number.'\');
PostAffTracker.register();
</script>';

That’s it. Save your work and upload it back to the server.

Here is a list of all variables you can use:

  • $order['details']['BT']->order_total
  • $order['details']['BT']->order_subtotal
  • $order['details']['BT']->tax
  • $order['details']['BT']->coupon_discount
  • $order['details']['BT']->coupon_code
  • $order['details']['BT']->order_status

Virtue Mart with Cheque in Joomla

In case of Cheque payment method you have to modify the file **_/plugins/vmpayment/standard/standard.php_** and insert the sale tracking code there.

Find the line:

$modelOrder->updateStatusForOneOrder ($order['details']['BT']->virtuemart_order_id, $order, TRUE);

and paste this code below that line:

/* Post [Affiliate](https://www.postaffiliatepro.com/affiliate-marketing-glossary/affiliate/ "Discover the role of an affiliate in marketing—earn commissions by promoting products through banners, links, and campaigns. Learn how affiliates drive sales and explore effective marketing strategies. Join the world of affiliate marketing with Post Affiliate Pro for user-friendly tools and exceptional support.") Pro integration snippet */
$html .= '<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
  <script type="text/javascript">
  PostAffTracker.setAccountId(\'default1\');
  var sale = PostAffTracker.createSale();
  sale.setTotalCost(\''.$order['details']['BT']->order_subtotal.'\');
  sale.setOrderID(\''.$order['details']['BT']->order_number.'\');

  PostAffTracker.register();
  </script>';
/* /Post Affiliate Pro integration snippet */

Save your work and you are done. You can use the same extra variables described in step 10.

Virtue Mart with GoogleCheckout in Joomla

The first step is to edit file ***/plugins/vmpayment/osegooglecheckout/osegooglecheckout.php*** and to find function *plgVmConfirmedOrder* .

Now, find line (in the end of the function):

$html.= '</form>';

Now change this line to these lines instead:

/* Post Affiliate Pro integration snippet */
$html.= '<input id="pap_dx8vc2s5" type="hidden" name="shopping-cart.items.item-1.merchant-private-item-data" value="" />';
$html.= '<script id="pap_x2s6df8d" src="//URL_TO_PostAffiliatePro/scripts/notifysale.php" type="text/javascript">'."\n".'</script>';
$html.= '</form>';
/* /Post Affiliate Pro integration snippet */

Additionally, change line:

$html.= ' document.vm_google_form.submit();';

to this line:

$html.= ' setTimeout("document.vm_google_form.submit()",3600);';

This will ensure the tracking will work with GoogleCheckout buttons.

Virtue Mart with GoogleCheckout in Joomla

The second and the last step of GoogleCheckout integration is to place cURL code to its correct place – find the function ***plgVmOnPaymentResponseReceived*** and place the following code to the start of the function:

/* Post Affiliate Pro integration snippet */
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,
"https://URL_TO_PostAffiliatePro/plugins/GoogleCheckout/googlecheckout.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST);
curl_exec($ch);
/* /Post Affiliate Pro integration snippet */

Note: URL https://URL_TO_PostAffiliatePro/plugins/GoogleCheckout/googlecheckout.php must be on secure domain (More on Google documentation).

Do not forget to integrate the click tracking code, to make the sale tracking work correctly.

Frequently asked questions

What is Virtue Mart 2 integration with Post Affiliate Pro?

Virtue Mart 2 integration allows you to connect your Joomla-based e-commerce store with Post Affiliate Pro, enabling advanced affiliate sale tracking for various payment methods such as PayPal, COD, Cheque, and GoogleCheckout.

Which payment methods are supported in Virtue Mart 2 integration?

The integration provides tracking methods for PayPal, Cash on Delivery (COD), Cheque, and GoogleCheckout, each with specific instructions for accurate affiliate sale recording.

Is Virtue Mart 2 integration free?

Yes, Virtue Mart 2 is a free e-commerce solution, and the integration guide helps you implement affiliate sale tracking without additional costs.

Do I need coding skills to integrate Virtue Mart 2 with Post Affiliate Pro?

Basic familiarity with editing PHP files in your Joomla installation is required to follow the step-by-step integration process provided.

Where can I get help with the integration?

For support and guidance, you can schedule a one-on-one call or contact the Post Affiliate Pro support team available 24/7.

Create account for FREE

Experience the power of Post Affiliate Pro with our 1-month free trial. Test our user-friendly affiliate marketing software with 24/7 support and robust affiliate management features.

You will be in Good Hands!

Join our community of happy clients and provide excellent customer support with Post Affiliate Pro.

Capterra
G2 Crowd
GetApp
Post Affiliate Pro Dashboard - Campaign Manager Interface