Jump to content

How to pass a variable from PaymentModule->validateOrder() to a module's hookPaymentReturn


defuzed

Recommended Posts

Hello,

 

i'm trying to pass a variable defined in the validateOrder() function of the PaymentModule class into a custom payment module's hookPaymentReturn function. I thought i could achieve this through the $params array, unfortunately if i try to add a variable to the 

Hook::exec('actionValidateOrder', array();

it doesn't seem to get passed into the hookPaymentReturn. (if i d($params) in that function my variable doesnt appear).

 

I'm obviously not good at php, help appreciated!

Link to comment
Share on other sites

Hey Bellini,

 

in PaymentModule->validateOrder() i used:

// Hook validate order
Hook::exec('actionValidateOrder', array(
  'cart' => $this->context->cart,
  'order' => $order,
  'customer' => $this->context->customer,
  'currency' => $this->context->currency,
  'orderStatus' => $order_status,
  'postUpload' => $post_upload //added by me $post_upload is a boolean
));

which, as i gathered from other topics was where the hook got its $params from.

 

and then in my modules hookPaymentReturn() i used:

$has_post_upload = $params['postUpload'];

to access the variable...

what am i doing wrong?

Edited by defuzed (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...