Custom plugin to manipulate onsuccess and oncancel order events

Started by mtaras, October 01, 2012, 20:01:40 PM

Previous topic - Next topic

mtaras

Hi,
these days I try to develop a custom vm2 plugin for my site.

What I need is a plugin with which I can set some actions (db queries) when an order status changed to confirmed or cancel (or extending this functionality to control all changes to status orders).

I 'm wondering which king of plugin I have to develop, payment or extension type plugin in according to http://dev.virtuemart.net/projects/virtuemart/wiki/Plugin_system ?

Firstly I think that the payment plugin is the right choice. But the control of the changing status of orders that I need to implement, I want to applied to all of payment methods not to only one. So I think that the payment plugin is not the right choice, right?

So the I think about the extension plugin but I have no idea from where I can find info about the developing of custom extension plugin of VM2. Only at this page I found some code (http://dev.virtuemart.net/projects/virtuemart/wiki/Extension_Plugins) but how can I set my plugin to run when order status changed and how can I control some actions when the status changed to some values?

Thanks.

mtaras

I try a lot these days...
And finally conclude to the payment plugin. I have not understand that the payment plugin could executed from other payment plugin. I was thinking that a payment plugin is only a method of peyment. This is not right. A payment plugin could executed through the payment process.

One question:
I have found the method
function plgVmConfirmedOrder($cart, $order) {
}

that I can use to do some action when an order confirmed.

Which is the method to manipulate the changing status of an order?

Thanks.

mtaras

One more question please.
Is it possible that a payment plugin runs when I change the status order from admin panel of orders?

mtaras

Finally I find the properly function.
It is the
function plgVmOnUpdateOrderPayment() {
}

This function called when the status changes from the checkout process or from the backend.

I will continuous with my developing and I'll inform if something useful take in my eyes.