
Virtue Mart 3
Would you like to improve your affiliate software even more? Check out the Virtue Mart 3 integration for Post Affiliate Pro.
Virtue Mart is a free e-commerce solution with PayPal integration, enabling unique transactions and product editing within orders. Integration is achieved by adding code to the confirmation page. Special steps are needed for PayPal in Joomla.
A free e-commerce solution.
Integration with Virtue Mart is made by placing sale tracking script into the confirmation page.
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 ?>');
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.
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
It is now integrated. Every time customer enters the order confirmationpage the tracking code is called and it will register a sale forreferring affiliate.
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.
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.
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”=>…
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.
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.
Pros:
Cons:
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.
If you’re exploring other eCommerce platforms besides Virtue Mart, consider these options:
Virtue Mart is a free and open-source eCommerce solution designed as an extension for Joomla! CMS. It offers over 500 features, supports multiple languages and currencies, and is highly customizable for small to medium-sized businesses.
Integration is achieved by placing a tracking script into the order confirmation page template. Specific integration steps and code samples are provided to ensure accurate sale tracking and affiliate commission management.
Yes, Virtue Mart is an open-source platform and is free to download and use. Additional costs may occur if you choose premium extensions, hosting, or professional support.
Pros include cost-effectiveness, high customizability, and seamless integration with Joomla!. Cons involve a steeper learning curve and potential template compatibility issues.
Yes, alternatives include Etsy, PrestaShop, OpenCart, and BigCommerce, each offering unique features for different eCommerce needs.
Streamline your Virtue Mart e-commerce store by integrating with Post Affiliate Pro. Track sales, manage affiliates, and boost your online business today.
Would you like to improve your affiliate software even more? Check out the Virtue Mart 3 integration for Post Affiliate Pro.
Discover how to seamlessly integrate Virtue Mart 2 with Post Affiliate Pro for advanced affiliate tracking in your Joomla e-commerce store. Step-by-step guides ...
Would you like to improve your affiliate software even more? Check out the ZenCart integration for Post Affiliate Pro. Integrate ZenCart for seamless shopping c...