VirtueMart Forum

VirtueMart 2 + 3 + 4 => Plugins: Payment, Shipment and others => Topic started by: Kuubs on June 30, 2020, 13:07:34 PM

Title: Plugin method before order success
Post by: Kuubs on June 30, 2020, 13:07:34 PM
Hello,

I have a plugin but I need to add an extra check before the order is confirmed so that everything goes okay. What is the method for the plugin to fire before the order is succeeded? I have now plgVmConfirmedOrder but that still goes through.

   $cart->_confirmDone = FALSE;
$cart->_dataValidated = FALSE;
$cart->setCartIntoSession();
return FALSE;


Is this the correct code to send the customer back to the cart with an error?
         

Customer presses confirm order, my plugin needs to check certain things, if success, go through, if not return to cart page.
Title: Re: Plugin method before order success
Post by: AH on June 30, 2020, 18:06:06 PM
Yes plgVmConfirmedOrder is triggered after the order is written to the tables

you could check earlier using

plgVmDisplayListFEPayment


You could go this way but -

What is the check

Because you may be able to do it easier in JS as a cart override and not display the confirm button until your "status" is met.


Difficult to guess my way through this


Title: Re: Plugin method before order success
Post by: Kuubs on July 03, 2020, 11:41:30 AM
Quote from: AH on June 30, 2020, 18:06:06 PM
Yes plgVmConfirmedOrder is triggered after the order is written to the tables

you could check earlier using

plgVmDisplayListFEPayment


You could go this way but -

What is the check

Because you may be able to do it easier in JS as a cart override and not display the confirm button until your "status" is met.


Difficult to guess my way through this

I need to check it server side for better security. I used plgVmOnCheckoutCheckDataShipment