Jump to content

Override, Hook or Impossible?


Rubens Cury

Recommended Posts

I need that regardless of the payment module that is installed and in use, my module should be able to handle the Payment Return (or similar) process that brings the return of the payment transaction and retrieve only specific values in which may can be obtained through the Query Url / Post / Etc.

 

No matter what module is working on the Payment process, once the user set on the module's configuration the specific values he wants to monitor, my module should be able to try to get them looking up the query url or post and if they have found, store them.

 

At the beginning I thought to use hooks, installing "hookDisplayPaymentReturn" on my module, but I noticed this hook is just executed once by the activated payment module.

 

Later, I got a suggesting to execute my actions through OrderConfirmationController, putting a call right after this line 

return Hook::exec('displayPaymentReturn', $params, $this->id_module); into displayPaymentReturn function.

 

Prestashop says here http://doc.prestashop.com/display/PS16/Overriding+default+behaviors that Overrides are forbidden in partners modules.

 

Anybody?

 

Link to comment
Share on other sites

  • 1 year later...

Did you get this resolved? I'll suggest something for you or others looking:

You should be able to use "displayOrderConfirmation", as this is executed together with "displayPaymentReturn" by OrderConfirmationController, but "displayOrderConfirmation" isn't using the module_id parameter to "Hook::exec('displayOrderConfirmation', $params);" so it should invoke all modules registered for that hook, not just the currently used payment module.

 

That is, register and implement a displayOrderConfirmation hook in your module and it should get called for all payment methods and it's returned content should be written to the order-confirmation page.

 

 

Regards,

Erik Knudsen

Link to comment
Share on other sites

You could use orderConfirmation or  actionValidateOrder hooks

 

orderConfirmation would really be used on the front end to show a message, or inject some javascript code on the order confirmation page

actionValidateOrder would be more of a server side hook, allowing you to react to new orders that are created.

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...