Virtue Mart integration
A free e-commerce solution.
How to integrate PostAffiliatePro with Virtue Mart
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/‘.
Integration
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 ?>');
PostAffTracker.register();
</script>
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 );
$i='0';
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');
$i++;
}
?>
<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
<script type="text/javascript">
PostAffTracker.setAccountId('Account_ID');<?php
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".
"sale".$j.".setOrderID('".$order_id."');\n".
"sale".$j.".setData1('".$pap_user_email."');\n".
"sale".$j.".setCoupon('".$pap_coupon_code."');\n".
"sale".$j.".setProductID('".$pap_product_id[$j]."');\n\n";
}
?>
PostAffTracker.register();
</script>
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
Finished
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);
curl_exec($ch);
/* 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”=>…
What is Virtue Mart?
Virtue Mart is a free and open-source eCommerce solution designed as an extension of the Joomla! Content Management System (CMS). Renowned for its flexibility and performance, Virtue Mart caters to a wide range of user needs with over 500 features. It supports multiple languages and currencies, offers secure transaction options through various payment gateways, and includes robust tools for inventory management and search engine optimization (SEO).
Originally stemming from a shopping cart script named phpShop, Virtue Mart established its own identity in 2005. By integrating seamlessly with Joomla!, it evolved into a powerful and adaptable eCommerce platform. Since the release of Virtue Mart 2, the platform has undergone continuous updates, backed by a vibrant community dedicated to its advancement.
Virtue Mart targets small to medium-sized businesses and individuals conscious of their budget. It appeals to those seeking scalable online eCommerce solutions that integrate smoothly with Joomla!. Developers and startups in need of customizable and cost-effective platforms find Virtue Mart particularly beneficial.
Key Features of Virtue Mart
- Comprehensive Product Management: Efficiently manage products with advanced catalog features.
- Flexible Checkout Options: Enhance customer experience with multiple checkout methods.
- SEO-Friendly Structure: Improve online visibility through built-in SEO tools.
- Multilingual and Multi-Currency Support: Reach a global audience by supporting various languages and currencies.
- Advanced Shopper Management: Effectively handle customer information and preferences.
- Extensive Community and Documentation: Access a wealth of resources and community support.
- Rich Extensibility: Expand functionality with numerous extensions and plugins.
- Integrated Marketing Tools: Utilize promotional tools for discounts, coupons, and more.
- Robust Security and Performance: Ensure secure transactions and optimize site performance.
Pricing Options for Virtue Mart
As an open-source platform, Virtue Mart itself is free to download and use. Additional costs may arise from optional extensions, templates, or services such as hosting and professional support, depending on the specific needs of the user.
User Insights on Virtue Mart
Pros:
- Cost-Effective: Being free and open-source makes it accessible for businesses with limited budgets.
- Highly Customizable: Offers extensive customization options to tailor the platform to specific requirements.
- Flexible Integration: Seamlessly integrates with Joomla!, enhancing functionality.
Cons:
- Technical Expertise Required: Initial setup and customization may require knowledge of Joomla! and web development.
- Template Compatibility Issues: Users have reported challenges when integrating with third-party templates.
Overall, users have a positive experience with Virtue Mart, appreciating its flexibility and robust feature set while acknowledging a learning curve for those without technical backgrounds.
Alternatives to Virtue Mart
If you’re exploring other eCommerce platforms besides Virtue Mart, consider these options:
- Etsy: Ideal for handmade and vintage items – etsy.com
- PrestaShop: A free, open-source eCommerce solution – prestashop.com
- OpenCart: User-friendly and feature-rich shopping cart system – opencart.com
- BigCommerce: A scalable platform with extensive built-in features – bigcommerce.com
Effortlessly integrate your e-commerce site with Post Affiliate Pro and boost your affiliate program's success. Our expert team ensures seamless integration with your payment processor, handling technical issues along the way. Enjoy a free trial and free integration service, saving you time and maximizing your ROI. Join now and experience top-notch affiliate management with over 500 integration options.
Explore seamless integrations with Post Affiliate Pro to enhance your affiliate marketing strategies. Discover solutions for e-commerce, email marketing, payments, and more, with easy integrations for platforms like 1&1 E-Shop, 2Checkout, Abicart, and many others. Optimize your affiliate network with these powerful tools.
Discover seamless integration of Virtue Mart 2 with Post Affiliate Pro for tracking sales on Joomla with payment methods like PayPal, GoogleCheckout, and more. Enhance your e-commerce solutions with our step-by-step guide to set up sale tracking using JavaScript and API. Explore the benefits of integrating with Post Affiliate Pro today!