Language switcher

#languages]

–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

Example:
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.

Integrations

Maximize the value of your existing affiliate marketing software and extend its possibilities with a wide range of integrations, plugins and apps. All built to improve the strong foundations of Post Affiliate Pro.

ZenCart

A user-friendly PHP-based shopping cart system.

Integration with ZenCart is made by placing sale tracking script into the order confirmation page.

Edit template

To integrate ZenCart you should edit the order confirmation template. Open the file includes/templates/template_default/templates/tpl_checkout_success_default.php.

Locate integration place

Find the line with following code which should already exist in the file.

<div id="checkoutSuccessOrderNumber"><?php echo TEXT_YOUR_ORDER_NUMBER . $zv_orders_id; ?></div>

Integration

Copy & Paste the following code into the file, under the line found above:

<?php
$dbreq = $db->Execute("select * from ".TABLE_ORDERS_TOTAL." where orders_id = '".(int)$orders->fields['orders_id']."' AND class in ('ot_coupon', 'ot_gv', 'ot_subtotal', 'ot_group_pricing', 'ot_quantity_discount')");
while (!$dbreq->EOF) {
  switch ($dbreq->fields['class']) {
    case 'ot_subtotal': $order_subtotal = $dbreq->fields['value']; break;
    case 'ot_coupon': $coupon_amount = $dbreq->fields['value']; $coupon_code = $dbreq->fields['title']; break;
    case 'ot_group_pricing': $group_pricing_amount = $dbreq->fields['value']; break;
    case 'ot_gv': $gv_amount = $dbreq->fields['value']; break;
    case 'ot_quantity_discount': $quantity_discount_amount = $dbreq->fields['value']; break;
  }
  $dbreq->MoveNext();
}
$totalCost = ($order_subtotal - $gv_amount - $coupon_amount - $group_pricing_amount - $quantity_discount_amount);
$totalCost = number_format($totalCost,2,'.','');
$orderId = $dbreq->fields['orders_id'];

// ------------- coupon code --------------------------------------------------
$coupon_code = substr($coupon_code,(strpos($coupon_code,":"))+2);
$coupon_code = substr($coupon_code,0,strlen($coupon_code)-2);

// -------------products---------------------------------------------------------
$productId = "";
$dbreqa = $db->Execute("select products_id from ".TABLE_ORDERS_PRODUCTS." where orders_id = '".(int)$orders->fields['orders_id']."' ");
while (!$dbreqa->EOF) {
  $productId = $dbreqa->fields['products_id'];
  $dbreqa->MoveNext();
}
// ----------end products--------------------------------------------------------

print '<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
<script type="text/javascript">';
print "PostAffTracker.setAccountId('Account_ID');";
print 'var sale = PostAffTracker.createSale();
sale.setTotalCost(\''.$totalCost.'\');
sale.setOrderID(\''.$orderId.'\');
sale.setProductID(\''.$productId.'\');
sale.setCoupon(\''.$coupon_code.'\');
PostAffTracker.register();
</script>';
?>

Ok, the integration is finished. Now every time a sale occurs, the shop will call our script and register the sale commission.

Lifetime commissions integration

If you want to integrate the Lifetime commissions plugin, then just add the code below into the code from step 3. after this line:

$orderId = $dbreq->fields['orders_id'];
$dbreq = $db->Execute("select * from ".TABLE_ORDERS_TOTAL." where orders_id = '".(int)$orders->fields['orders_id']."' ");
while (!$dbreq->EOF) {
  $email = $dbreq->fields['customers_email_address'];
  $dbreq->MoveNext();
}

Also you need to add this code:

sale.setData1(\''.$email.'\');

right after the:

sale.setOrderID(\''.$orderId.'\');

In case you want to know the payment method name used in the order, you can use this variable:

$orders->fields['payment_method']

zenCart + PayPal – part 1

In case you use PayPal as a payment gateway in ZenCart then a different integration approach is needed.

In ‘zenCart_installation_directory/includes/functions/html_output.php‘ find the following line:

$field = '<input type="hidden" name="' . zen_sanitize_string(zen_output_string($name)) . '"';

and replace it with this one:

if ($name == 'notify_url') {
	$field = '<input type="hidden" id="pap_ab78y5t4a" name="' . zen_output_string($name) . '"';
} else {
	$field = '<input type="hidden" name="' . zen_output_string($name) . '"';
}

zenCart + PayPal – part 2

Into ‘zenCart_installation_directory/includes/templates/template_default/common/tpl_footer.php‘ add the following code:

<!-- PAP Integration snippet -->
<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
<script type="text/javascript">
PostAffTracker.setAccountId('default1');
PostAffTracker.writeCookieToCustomField('pap_ab78y5t4a', '', 'pap_custom');
</script>
<!-- /PAP Integration snippet -->

zenCart + PayPal – part 3

Into ‘zenCart_installation_directory/ipn_main_handler.php‘ add the following code:

/* Post Affiliate Pro integration snippet */
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://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 */

That’s it.

Now, log in to the merchant panel of Post Affiliate Pro (Network), navigate to the “Plugins” section and activate the “PayPal IPN Handling” plugin.

NOTE: If you wish to enable Lifetime Commission integration when using this ‘zenCart + PayPal‘ integration method, then in the configuration of “PayPal IPN Handling” plugin turn on the ‘Support lifetime commission‘ option.

Do not forget to integrate your site with the click tracking code to make the sale tracking working correctly.

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