- Posts: 259
- Thank you received: 22
Accessing Order-id after order created.
- rodfarrell
-
Topic Author
- Offline
Less
More
9 years 6 months ago #264199
by rodfarrell
Accessing Order-id after order created. was created by rodfarrell
I have an SAP integration where the contents of an order are passed to an SAP server by a System Plugin when the order is saved. To complicate matters the Joomla site is accessed from the customers purchasing system which uses the same login account for all orders and multiple employees can be creating orders at the same time. This is OK because all orders are kept separate by the session id.
Here is my problem. Currently the system plugin gets the order details by calling up the last order id for the customer which works 99% of the time but occasionally returns the wrong details when two order are created simultaneously. When I use $this->order nothing is returned as it seems the variable has already been removed. What is the best way to keep the order_id as a global or session variable so it is available after the order is created? ie. What file would I declare this in and in what format?
Here is my problem. Currently the system plugin gets the order details by calling up the last order id for the customer which works 99% of the time but occasionally returns the wrong details when two order are created simultaneously. When I use $this->order nothing is returned as it seems the variable has already been removed. What is the best way to keep the order_id as a global or session variable so it is available after the order is created? ie. What file would I declare this in and in what format?
Please Log in or Create an account to join the conversation.
- rodfarrell
-
Topic Author
- Offline
Less
More
- Posts: 259
- Thank you received: 22
9 years 6 months ago #264202
by rodfarrell
Replied by rodfarrell on topic Accessing Order-id after order created.
Found it. The code below seems to do the job.
$app =& JFactory::getApplication();
$order_id = $app->getUserState('com_hikashop.order_id');
$app =& JFactory::getApplication();
$order_id = $app->getUserState('com_hikashop.order_id');
Please Log in or Create an account to join the conversation.
9 years 6 months ago #264209
by nicolas
Replied by nicolas on topic Accessing Order-id after order created.
Hi,
Yes, you can use that code.
Note that normally, you can use the trigger onAfterOrderCreate which provides the variable $order with all the order details, including the order_id in your plugin:
www.hikashop.com/support/documentation/6...l#onAfterOrderCreate
Yes, you can use that code.
Note that normally, you can use the trigger onAfterOrderCreate which provides the variable $order with all the order details, including the order_id in your plugin:
www.hikashop.com/support/documentation/6...l#onAfterOrderCreate
Please Log in or Create an account to join the conversation.
Time to create page: 0.156 seconds