VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Coding Central => Topic started by: wassie on July 03, 2014, 21:25:40 PM

Title: Understand checkout proces
Post by: wassie on July 03, 2014, 21:25:40 PM
hi,

I want to use Virtuemart for selling licenses. When a payment is succesfull, I want to trigger a custom PHP script, that will get the license by a API. My problem is that I don't know where I have to place the trigger for my custom script. Can someone tell me where I can find information about the checkout proces and where I can include my scripts?

thank you!
Title: Re: Understand checkout proces
Post by: GJC Web Design on July 03, 2014, 23:19:33 PM
What happens after a successful payment is handled by the payment plugin that calls various routines

have a look in a simple payment plugin (authorize etc)

these routines are in orders.php model .. some triggers like function plgVmConfirmedOrder ($cart, $order)

if you have that function in a vmcustom plugin it will be called by the orders.php on a successful payment
Title: Re: Understand checkout proces
Post by: wassie on July 04, 2014, 09:25:39 AM
Thank you GJC Webdesign for your quick reply!

I have found that file in different directorys, but I guess that you mean the one in /administrator/components/com_virtuemart/models. I also found a $returnValues variable. But I don't know when the default paymentstatus of payment plugin status, is changed, and where I could call my script when the payment is succesfull.

I'm just a starter with PHP.
Title: Re: Understand checkout proces
Post by: GJC Web Design on July 04, 2014, 12:27:18 PM
yes - it is the models/orders.php but you don't need to touch it - just look what is happening there and when the plugins are triggered

you need to build a custom vm plugin then to do what u want and that is triggered when the order is confirmed

e.g. on order confirmation any function named function plgVmConfirmedOrder ($cart, $order) in a vmcustom plugin will run
Title: Re: Understand checkout proces
Post by: wassie on July 04, 2014, 21:19:39 PM
my script will not directly do anything with Virtuemart or Joomla. I want to first connect with a API to retrieve information. Then I want to send that information to my customer. I think it can work, without Virtuemart of Joomla. But my script can only be triggert when the payment was succesfull. So I need to know on which point that is, so where I can include my script.
Title: Re: Understand checkout proces
Post by: GJC Web Design on July 04, 2014, 22:45:32 PM
Sorry. this is what I do for a job - I'm not going to write the thing for you.. need more help (which I think I gave enough) .. then employ me

I think I gave you enough pointers
Title: Re: Understand checkout proces
Post by: wassie on July 05, 2014, 01:11:17 AM
I don't want to hire you, I just want to know how the proces of Virtuemart works. But okay, I respect your point and I will try to figure it out on a different way. Thanks!
Title: Re: Understand checkout proces
Post by: GJC Web Design on July 05, 2014, 01:16:31 AM
hmmm - no one ever wants to pay for anything - when your car breaks down do u loiter outside garages asking for advice?

I explained what happens when an order is confirmed and what u need to do to fire your api upon this event... how else will you do it without a plugin?
Title: Re: Understand checkout proces
Post by: Milbo on July 05, 2014, 21:07:26 PM
I would use a cutomplugin. It also makes sense to ask a pro like us todo it for you.