Author Topic: Plugin method before order success  (Read 144 times)

Huubs

  • Jr. Member
  • **
  • Posts: 227
Plugin method before order success
« 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.

   
Code: [Select]
$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.

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3230
  • VirtueMart Version: 3.8.4
Re: Plugin method before order success
« Reply #1 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


regards
A

Joomla 3.9.19
php 7.3

Huubs

  • Jr. Member
  • **
  • Posts: 227
Re: Plugin method before order success
« Reply #2 on: July 03, 2020, 11:41:30 am »
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