News:

Looking for documentation? Take a look on our wiki

Main Menu

Payment Plugin - trigger function after order confirmed

Started by alexdran, October 08, 2012, 23:02:25 PM

Previous topic - Next topic

alexdran

Hello all
is it possible to create a plugin for virtueMart payment only to catch an order confirmed
(and launch then an external script) ?

suggestion if possible to achieve and on how to address it?

thank you in advance for the help
alex  :)

bytelord

Hello,

Confirmed by who? Do you mean someone makes an order and wait's a confirmation?
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

alexdran

Quote from: bytelord on October 08, 2012, 23:22:36 PM
Hello,

Confirmed by who? Do you mean someone makes an order and wait's a confirmation?

I mean an order passed that arrives in 'C' / Confirmed status

But also catch the event of changing order Status would be enough, of course having also information about the order passed for my script to be launched

I want to manage membership subscriptions with this system, then update a table where every subscription date is updated after the order (i.e. product 1Year subscription)


thank you again for any help

bytelord

Hello,

it think you have do develop a plugin for that and for subscriptions also a component to mange them.

More information could be found here: http://dev.virtuemart.net/projects/virtuemart/wiki/Plugin_system
here: http://dev.virtuemart.net/projects/virtuemart/wiki/Payment_Plugins
and here: http://dev.virtuemart.net/projects/virtuemart/wiki/Product_Plugins

btw, this can be configured under payment plugins, what's your vm version?

Regards
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

alexdran

forgot to add indeed

I'm working on joomla 2.5 and virtueMart 2.0.12 installation


I agree on the need of having a component to show and manage subscriptions, for the rest:
where do I need to look for the function to intercept order status ?
Payment or Product plugin?

I have looked for the function on the plugin page without finding anything interesting (unless any oversight)

thank you again

bytelord

Hello,

You could study payment standart plugin for example. The event that fired is plgVmConfirmedOrder

Regards
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

alexdran


alexdran

I have created a plugin
with

plgVmConfirmedOrder ($cart, $order) {

printing some the $order variable and exiting (in order for me to see is processed)

there is no check at the beginning if another method is selected (it should be called any payment method selected)


the plugin is installed and activated
however completing the order it is not called (otherwise the php would die())


does the method is called also in back-end when in the list of orders a status is changed ??
I do not think so... What do you think I need to use in that case alternatively, since my first try is not effective ?


thank you again
alex

bytelord

Hi,

you can study the vm core, i am sure you will find the functions that running when status changed. The first method is only triggered when user's checkout ... not in the backend. So maybe you need 2 of them, or hack the core and edit the 'C' state "function" to do something more .. what you want i suppose. Alternative a plugin but cannot trigerred from the backend.

Regards
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

alexdran

thank you again for the suggestion

I cannot however achieve the first step of catching the order passed
I have created a paypal payment plugin and also tried with a custom plugin; both are active on joomla;
the payment plugin is also selected among payment plugins (even if is not appearing on the select-payment-method step in home page; and this is good, since has to be transparent)


i have declared the following functions:
- plgVmOnPaymentResponseReceived
- plgVmOnPaymentNotification
- plgVmOnConfirmedOrderStorePaymentData
- plgVmConfirmedOrder

printing the function name and exiting the script; but the purchase process ends normally ("with thank you message") and apparently
it is not passing by my methods at all

any additional suggestion on what should I look for to intercept the payment?

thank you again 
:)

bytelord

Hello,

plgVmOnPaymentResponseReceived and plgVmOnPaymentNotification are trigerred usually from the external hosts (like paypal, cc, etc) for validation or returns the successful payment, its a custom url if you look better inside the files you study.
you should create a plugin to "track" those, may be the payment method comes first, may be play with ordering. I have create some payment plugins and the triggers was successfully trigerred. Also enable debugging to follow it better.

Regards
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

RCheesley

Sorry to resurrect an old post, but did you get anywhere with this? I've got a plugin written which hooks Akeeba Subs into VM and I can get it to trigger in the back-end using plgVmOnUpdateSingleItem but this doesn't seem to be getting triggered in the front-end when confirmation comes in from PayPal?

I've also tried the triggers mentioned here but none seem to fire on front-end :(

Ruth