News:

Looking for documentation? Take a look on our wiki

Main Menu

OnNewOrder Plugin?

Started by Greg P, November 05, 2012, 21:57:14 PM

Previous topic - Next topic

Greg P

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!

reinhold

#1
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