VirtueMart Forum

VirtueMart 2 + 3 + 4 => Plugins: Payment, Shipment and others => Topic started by: Cameleon on October 28, 2016, 14:50:42 PM

Title: [VM3] Using custom code after payment callback
Post by: Cameleon on October 28, 2016, 14:50:42 PM
Greetings,

I'm currently rebuilding an old website running Virtuemart 1.1.7 to a brand new with virtuemart 3.

This website use some custom code who create an XML file every time an order is paid (for an external software).

Currently we use this code in :

/administrator/components/com_virtuemart/notify.php
/administrator/components/com_virtuemart/html/checkout.cmcic_cgi2.php

Here is an exemple :
Quotecase "paiement":
   [...]
   if($dbo->next_record()){
       if($dbo->f('order_status')=='A'){
         require_once(CLASSPATH.'SAP_XML/handleXML.php');
         $handleXml= new handleXML('sap'.$dbo->f('order_id').'.xml', $dbo->f('user_id'),$dbo->f('order_id'));
         $handleXml->save();
       }
   }
   break;
   default:
   require_once(CLASSPATH.'ps_checkout.php');
   $ps_checkout= new ps_checkout();
   $ps_checkout->email_receipt_vendor($d['order_id']);
   break;

But these files doesn't exist anymore in VM3. And i don't know where are their equivalent.

Where can i add my custom code when a payment is succesful then ?

Regards,

Bruno

Title: Re: [VM3] Using custom code after payment callback
Post by: kishoreonwork on October 29, 2016, 22:09:35 PM
Hello Bruno,

You need to look at the code in virtuemart payment plugin. The function  "plgVmConfirmedOrder" is triggered to make a order.
Virtuemart payment plugins are stored in  plugins\vmpayment\ folder.

Mostly at the end of this function you need to insert your code based on the payment status.


Thanks
Kishore
Title: Re: [VM3] Using custom code after payment callback
Post by: Cameleon on November 02, 2016, 15:50:35 PM
Thanks i'll take a look here.