VirtueMart: Extra payment information not shown on purchase order confirmation email
I’ve found this problem many times in VirtueMart forums, but never solved. If you do not know that, VirtueMart is a virtual shop component for Joomla CMS. It’s a good piece of code, however it has some problems -often not very important ones-, and its customization sometimes need hacking its code a bit.
I’m building one shop for La Curuxa - Productos Asturianos, still in a development server, and among other things I’ve found that extra payment information is not showed on purchase order confirmation email that’s sent to the customer. I’ve found other things like this that has been very easy to solve just editing VirtueMart templates -different from Joomla templates-, but this problem needs edit also one core file. I’m using Joomla 1.5.x and VirtueMart 1.1.3, that’s currently last stable version.
Within your Joomla installation, you’ll need to edit “administrator/components/com_virtuemart/classes/ps_checkout.php”. Localize and comment out this code:
$q = "SELECT op.payment_method_id, pm.payment_method_name FROM #__{vm}_order_payment as op, #__{vm}_payment_method as pm WHERE order_id='$order_id' AND op.payment_method_id=pm.payment_method_id";
And put this one instead:
$q = "SELECT * FROM #__{vm}_order_payment as op, #__{vm}_payment_method as pm WHERE order_id='$order_id' AND op.payment_method_id=pm.payment_method_id";
Next, in same file localize this code:
$template->set_vars(array( 'is_email_to_shopper' => true, 'db' => $db, 'dboi' => $dboi, 'dbbt' => $dbbt, 'dbst' => $dbst, 'ps_product' => $ps_product,
And put this instead:
$template->set_vars(array( 'is_email_to_shopper' => true, 'db' => $db, 'dboi' => $dboi, 'dbbt' => $dbbt, 'dbst' => $dbst, 'db_payment' => $db_payment, 'ps_product' => $ps_product,
As you see, you’ll just need to add “‘db_payment’ => $dbpayment” between “dbst” and “ps_product”.
Now open the file “components/com_virtuemart/themes/default/templates/order_emails/confirmation_email.tpl.php” and localize these two lines near to the end of the file:
<p class="Stil2"></p> <p class="Stil2">
Before these two lines, add this code:
<?php if ( $db->f("order_status") == "P" ) { // Copy the db object to prevent it gets altered $db_temp = ps_DB::_clone( $db ); /** Start printing out HTML Form code (Payment Extra Info) **/ ?> <table width="100%"> <tr> <td width="100%" align="center"> <?php @include( CLASSPATH. "payment/".$db_payment->f("payment_class").".cfg.php" ); echo DEBUG ? vmCommonHTML::getInfoField('Beginning to parse the payment extra info code...' ) : ''; // Here's the place where the Payment Extra Form Code is included // Thanks to Steve for this solution (why make it complicated...?) if( eval('?>' . $db_payment->f("payment_extrainfo") . '<?php ') === false ) { echo vmCommonHTML::getErrorField( "Error: The code of the payment method ".$db_payment->f( 'payment_method_name').' ('.$db_payment->f('payment_method_code').') ' .'contains a Parse Error!<br />Please correct that first' ); } ?> </td> </tr> </table> <?php $db = $db_temp; } // END printing out HTML Form code (Payment Extra Info) ?>
That code is mainly cloned from “account.order_details.tpl.php”, that was showing the extra payment information without problems. I do not understand some things in it, as I’m not familiarized with VirtueMart internals, but it works fine so… that’s all. Now your customers should receive the extra payment information where available within their purchase order email.


Thank you, works fine.
Excellent Post!!!
Thank you very much, you helped me a lot with this post!
Seguí las instrucciones pero dió error al abrir la web:
I followed the instructions but gave error when opening the web:
Parse error: syntax error, unexpected ‘<’, expecting ‘)’ in /home/cholscom/public_html/administrator/components/com_virtuemart/classes/ps_checkout.php on line 2092
Brilliant! Thanks!
Quite different from the rest, it endows me with worthwhile information that definitely increases my awareness on this particular subject. I, therefore, am very grateful to the author who sincerely posted this editorial for the benefits of the general public. Keep up your good work!
Thanks a lot for your very well done work!
Really great!!! Perfect!
Great! Quick fix with good result, really helped me out!