News:

Support the VirtueMart project and become a member

Main Menu

How to trigger some php Code after a check-out

Started by smalldragoon, April 25, 2018, 20:20:55 PM

Previous topic - Next topic

smalldragoon

Hello,
I would like to trigger some php code when a checkout is done.
Is there any way to perform this , ( or is there a plugin which allow this ? )
This PHP code will use for ex Virtuemart API to change the status order ( unlinked from the virtuemart workflow )
Thanks !

anantmaks

There is function
plgVmConfirmedOrder($cart, $order){}
This is triggered when checkout is done. Use it.
Anant Garg
Ghaziabad, India

smalldragoon

Hi Anant,
Thanks for your reply.
I'm a basic php coder, I'm not familiar at all with Joomla/Virtuemart.
I was thinking to something "standard" on which I can just add my code to .
To give you more insight, I want to trigger several action in order to perform a "Fraud risk scoring" .
Based on the result, I will update the order
Thx


anantmaks

The thing is when an order is created in VirtueMart, there are several methods triggered which we can use to achieve our desired functionality. For all these methods you can look into any payment plugin file, which you will fin in YOUR_SITE/plugins/vmpayment, like for Paypal it is YOUR_SITE/plugins/vmpayment/paypal/paypal.php. You'll find most methods there, which you can track by debugging that how the flow goes while creating an order.
Now in the same fashion, you can create your own system plugin and use these same methods names with your own method definitions(as you want to trigger several actions in order to perform a "Fraud risk scoring"). The concept is quite simple that these methods will get triggered in particular instances
Anant Garg
Ghaziabad, India