-- HikaShop version -- : 3.4.0
-- Joomla version -- : 3.8.7
-- PHP version -- : 7.1.0
Hi,
I have developed a Hikashop plugin with a trigger onAfterOrderUpdate.
This plugin generates a new order after an order is shipped (its status changes to Shipped).
I use this code (it's on the developer documentation):
If you want to create a new order, you can use such code:
$order = new stdClass();
$order->order_full_price = 0;
$order->order_currency_id = 1;
$order->order_user_id = 64;
$orderClass = hikashop_get('class.order');
$orderClass->save($order);
The operation (A) is this:
1. onAfterOrderUpdate triggers.
2. Check if the order_status is "shipped".
3. If it's shipped, replicates the information of the actual order (A) to a new object (
.
4. Calls the function $orderClass->save(object (
).
5. Other code runs after point 4....
I expect the function in point 4 to return the id of the new generated order, but the operation seems to never end (it gets stalled) even the order is created.
I need the operation to return the order_id to run some other actions at step 5 once the order has been generated and get back the control of the script (avoid stalling).
I never get the control of the website back, I have to close the browser window.
Shall I consider some extra step in my code?
EDIT: We have created a plugin that triggers when a new order is created just to check if afterOrderCreate trigger was triggering. I can confirm this. To me looks like when triggers from the new created order end, the system doesn't give control back to the original plugin triggered by the change of status of the first order (operation A).
Thanks in advance.
--
Victor