XtCommerce
Would you like to improve your affiliate software even more? Check out the XtCommerce integration for Post Affiliate Pro.
Integrate Post Affiliate Pro with ZenCart and PayPal for efficient shopping cart and payment management. Follow code snippets for successful integration and activate the PayPal IPN Handling plugin. Ensure sale tracking with click tracking code.
A user-friendly PHP-based shopping cart system.
Integration with ZenCart is made by placing sale tracking script into the order confirmation page.
To integrate ZenCart you should edit the order confirmation template. Open the file includes/templates/template_default/templates/tpl_checkout_success_default.php .
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>
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.
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']
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) . '"';
}
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 -->
Into ‘** zenCart_installation_directory/ipn_main_handler.php ** ‘ add the following code:
/* [Post Affiliate Pro](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!") 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.
ZenCart is an open-source e-commerce platform that empowers businesses to create and manage their online stores with ease. Designed for flexibility and extensive customization, ZenCart allows users to tailor their stores to handle various product types and layouts. The platform supports customizable displays, detailed product information, and a wide range of e-commerce functionalities, all built upon a robust database schema that accommodates diverse product layouts.
Originating from a fork of the osCommerce project in 2003, ZenCart has evolved significantly over the years. One of the notable enhancements was the introduction of a distinct template system, setting it apart from its origins. The transition from a table-based design to CSS layouts in version 1.3.x modernized the platform, improving both aesthetics and functionality. Despite challenges like updating SEO functionalities, ZenCart has cultivated a dedicated community that continuously develops numerous plugins to enhance its features.
ZenCart is tailored for online store owners who seek a customizable and scalable e-commerce solution. It caters to both beginners and experienced users desiring extensive control over their store’s design and functionality. Ideal for businesses looking for open-source solutions, ZenCart supports multiple languages and currencies, making it suitable for a global market.
While ZenCart’s software is free to download and use, associated costs revolve around hosting services, SSL certificates for secure transactions, domain name purchases, and optional plugins for added features. Additional indirect costs may arise from customization needs and security enhancements essential for personalizing and maintaining an online store.
Pros:
Cons:
Overall, users appreciate ZenCart for its flexibility and control over their online stores. However, they note a learning curve and the potential need for professional assistance with advanced configurations.
If you’re exploring other options besides ZenCart, consider these e-commerce platforms:
ZenCart is an open-source e-commerce platform designed for flexibility and extensive customization, allowing businesses to create and manage online stores with ease. It offers robust product management, customizable interfaces, and supports multiple languages and currencies.
To integrate Post Affiliate Pro with ZenCart, place a sale tracking script into the order confirmation page template. Detailed code snippets and step-by-step instructions are provided for both standard and PayPal-based ZenCart setups.
Yes, by following additional integration steps and enabling the 'Lifetime commissions' plugin, you can track and assign commissions for all future sales from a customer, even beyond cookie expiration.
Yes, there are dedicated integration steps for ZenCart stores using PayPal, ensuring affiliate tracking works correctly with PayPal transactions.
ZenCart is free to download and use, but costs may arise from hosting, SSL certificates, domain names, and optional plugins or customizations.
Pros include high flexibility, free software, and strong product management. Cons include a basic default design, complex upgrades, and a basic reporting system that may require enhancements.
Lucia is a talented content editor who ensures the seamless publication of content across multiple platforms.
Experience seamless affiliate tracking by integrating ZenCart with Post Affiliate Pro. Enhance your e-commerce operations and boost your affiliate program's performance.
Would you like to improve your affiliate software even more? Check out the XtCommerce integration for Post Affiliate Pro.
Would you like to improve your affiliate software even more? Check out the Virtue Mart integration for Post Affiliate Pro.
Would you like to improve your affiliate software even more? Check out the osCommerce integration for Post Affiliate Pro.