User Feedback from an Order Status Change?

  • Posts: 108
  • Thank you received: 3
  • Hikashop Business
3 weeks 3 days ago #335864

-- HikaShop version -- : 4.4.3
-- Joomla version -- : 3.10.2
-- PHP version -- : 7.4.23

My latest custom PaymentPlugin uses onBeforeOrderUpdate to contact our gateway provider to capture funds (which were pre-authorized during the Order Creation) whenever the order is later changed from status 'created' to 'shipped' or 'confirmed'. This status change is executed from the Orders List Admin page, so the process is actually executed in a Modal Window. Because of this, the Order listing is not reloaded after the method is finished. To view the actual changes made while changing the status, I have to reload the page manually. Even when I do that, I don't see any messages I added during the custom method using enqueueMessage.

Is there any way to send the User direct feedback from the onBeforeOrderUpdate Method, so I can let them know immediately if the custom capture process has succeeded or failed?

Last edit: 3 weeks 3 days ago by icomex.

Please Log in or Create an account to join the conversation.

  • Posts: 73880
  • Thank you received: 11330
  • MODERATOR
3 weeks 3 days ago #335868

Hi,

You're on the right track. The problem is that the messages you add from a popup with enqueueMessage is that it's the popup that is displaying the messages, but since HikaShop stops the processing in the popup to close it, you're not seeing them.
And even if you reload the page manually, that won't change.

What I would recommend is for you to like this:

if($_REQUEST['tmpl']=='component') {
echo hikashop_display('My error message', 'error');
exit;
}
That will halt the process in the popup and display your error message in the popup.
If the payment capture is successful, then I would recommend to have that code in onAfterOrderUpdate:
if($_REQUEST['tmpl']=='component' && $this->payment_success) {
echo hikashop_display('My success message', 'success');
exit;
}
Doing it like that will prevent HikaShop from closing the popup and will display the message through HikaShop's message display system which works even when the process of the page is stopped, which joomla's doesn't.

The following user(s) said Thank You: icomex

Please Log in or Create an account to join the conversation.

  • Posts: 108
  • Thank you received: 3
  • Hikashop Business
3 weeks 1 day ago #335906

I'll give it a shot. Thanks!

Please Log in or Create an account to join the conversation.

Time to create page: 0.047 seconds
Powered by Kunena Forum