VirtueMart Forum

VirtueMart 2 + 3 + 4 => Plugins: Payment, Shipment and others => Topic started by: Greg P on November 05, 2012, 21:57:14 PM

Title: OnNewOrder Plugin?
Post by: Greg P on November 05, 2012, 21:57:14 PM
Having come from VM1 and J1.x, I am somewhat overwhelmed with VM2, and J2.5, and cannot determine if/where it is possible to specify some custom processing when a new order is added.

I need to be able to update some other non-VM tables with some information derived from a new order, and I am assuming (hoping) that there's a more eloquent way to do it in VM2 than adding some hacks to the core code.

Much thanks in advance, have always loved VM, and 2.x is great!
Title: Re: OnNewOrder Plugin?
Post by: reinhold on November 11, 2012, 22:54:27 PM
I suppose the cleanest way is to create a small vmshopper plugin for this.
There is the "plgVmOnUserOrder" event, which is called in administrator/components/com_virtuemart/models/orders.php (function _createOrder). So all you have to do is create a plugin of type vmshopper, derive the class (needs to be named like vmShopperYOURPLUGINNAME!) from vmShopperPlugin and add your code to plgVmOnUserOrder...



Cheers,
Reinhold