- Posts: 21
- Thank you received: 0
onAfterOrderUpdate is not being triggered
6 years 1 month ago #322881
by ajdev33
onAfterOrderUpdate is not being triggered was created by ajdev33
-- HikaShop version -- : 4.3.0
-- Joomla version -- : 3.9.19
-- PHP version -- : 7.3
Hello,
I am facing an issue in my custom payment plugin. When I my order status changes programatically then no code is being executed written in onAfterOrderUpdate method.
However I am able to trigger this from back-end but it is not working from front-end.
Please let me know if I am missing anything.
Thanks
-- Joomla version -- : 3.9.19
-- PHP version -- : 7.3
Hello,
I am facing an issue in my custom payment plugin. When I my order status changes programatically then no code is being executed written in onAfterOrderUpdate method.
However I am able to trigger this from back-end but it is not working from front-end.
Code:
public function onAfterOrderUpdate(&$order) {
if($order->old->order_status == 'created' && $order->order_status == 'cancelled') {
echo "test"; die;
}
}
Please let me know if I am missing anything.
Thanks
Please Log in or Create an account to join the conversation.
6 years 1 month ago - 6 years 1 month ago #322886
by nicolas
Replied by nicolas on topic onAfterOrderUpdate is not being triggered
Hi,
What do you mean by "When I my order status changes programatically then no code is being executed" ?
What is done to change the order status from created to cancelled on your website ? Do you open a specific URL ?
For example, if the order status is changed during a payment notification, this is usually done with a server to server connection between the payment gateway and your website directly. And thus, if there is a "echo 'test';die;" happening, it will be the server of the payment gateway which will get back a white page with the text "test", not the customer. So you, as a customer won't see anything different whether that code is executed or not.
A better way to check if and when you go into that if is to write something to a file.
That's what we usually do with payment plugins by doing something like that:
hikashop_writeToLog('test');
That hikashop_writeToLog function can be called from anywhere on your website once HikaShop's core is loaded, and it will log in the text in the "payment log file" you can see in the Files section of the HikaShop configuration page.
What do you mean by "When I my order status changes programatically then no code is being executed" ?
What is done to change the order status from created to cancelled on your website ? Do you open a specific URL ?
For example, if the order status is changed during a payment notification, this is usually done with a server to server connection between the payment gateway and your website directly. And thus, if there is a "echo 'test';die;" happening, it will be the server of the payment gateway which will get back a white page with the text "test", not the customer. So you, as a customer won't see anything different whether that code is executed or not.
A better way to check if and when you go into that if is to write something to a file.
That's what we usually do with payment plugins by doing something like that:
hikashop_writeToLog('test');
That hikashop_writeToLog function can be called from anywhere on your website once HikaShop's core is loaded, and it will log in the text in the "payment log file" you can see in the Files section of the HikaShop configuration page.
Last edit: 6 years 1 month ago by nicolas.
Please Log in or Create an account to join the conversation.
6 years 1 month ago #322896
by ajdev33
Replied by ajdev33 on topic onAfterOrderUpdate is not being triggered
Yes, I tried writing file but nothing is being executed under this function from frontend.
Please Log in or Create an account to join the conversation.
Less
More
- Posts: 12953
- Thank you received: 1778
6 years 1 month ago #322900
by Mohamed Thelji
Replied by Mohamed Thelji on topic onAfterOrderUpdate is not being triggered
Hello,
Can you give us more information about what do you mean by "When I my order status changes programatically then no code is being executed" ?
Also, Can you tell us what you exactly want to achieve so that we can properly advise you ? Thank you
Kind regards,
Mohamed.
Can you give us more information about what do you mean by "When I my order status changes programatically then no code is being executed" ?
Also, Can you tell us what you exactly want to achieve so that we can properly advise you ? Thank you
Kind regards,
Mohamed.
Please Log in or Create an account to join the conversation.
Time to create page: 0.197 seconds