- Posts: 38
- Thank you received: 2
How to set new status to order
- Sergey Romanov
-
Topic Author
- Offline
Less
More
10 years 2 months ago #246487
by Sergey Romanov
How to set new status to order was created by Sergey Romanov
-- HikaShop version -- : 2.6.3
-- Joomla version -- : 3.6
-- PHP version -- : 5.6
-- Browser(s) name and version -- : Chrome 48
-- Error-message(debug-mod must be tuned on) -- : no error
This is Sergey from MintJoomla and my Integration with Emerald. You know that hikashop may sell subscriptions of Emerald.
One of our customers want to change status of Hikashop order, when subscription expires.
How to set new status for the order programmatically. I have status ID but it looks like it save status name. Is this only thing to save? Or I just update order_status field in DB table? Any cross reference tables?
-- Joomla version -- : 3.6
-- PHP version -- : 5.6
-- Browser(s) name and version -- : Chrome 48
-- Error-message(debug-mod must be tuned on) -- : no error
This is Sergey from MintJoomla and my Integration with Emerald. You know that hikashop may sell subscriptions of Emerald.
One of our customers want to change status of Hikashop order, when subscription expires.
How to set new status for the order programmatically. I have status ID but it looks like it save status name. Is this only thing to save? Or I just update order_status field in DB table? Any cross reference tables?
Please Log in or Create an account to join the conversation.
10 years 2 months ago #246491
by nicolas
Replied by nicolas on topic How to set new status to order
Hi,
You can do like that:
where XXX is the id of the order and YYY is the name of the status (it comes from the cartegory_name column in the hikashop_category table where the status are stored for now.
You can do like that:
Code:
if(!defined('DS'))
define('DS', DIRECTORY_SEPARATOR);
if(!include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php')) return true;
$orderClass = hikashop_get('class.order');
$order = new stdClass();
$order->order_id = XXX;
$order->order_status = 'YYY';
$orderClass->save($order);
The following user(s) said Thank You: Sergey Romanov
Please Log in or Create an account to join the conversation.
- Sergey Romanov
-
Topic Author
- Offline
Less
More
- Posts: 38
- Thank you received: 2
10 years 2 months ago #246532
by Sergey Romanov
Replied by Sergey Romanov on topic How to set new status to order
Thank you Nikolas. This is update of old order, not create new one?
Please Log in or Create an account to join the conversation.
10 years 2 months ago #246544
by nicolas
Replied by nicolas on topic How to set new status to order
Hi,
That's right. If you remove the line:
$order->order_id = XXX;
It would create a new order. But you can't create a new order if you specify an order_id which already exists
That's right. If you remove the line:
$order->order_id = XXX;
It would create a new order. But you can't create a new order if you specify an order_id which already exists
Please Log in or Create an account to join the conversation.
Less
More
- Posts: 14
- Thank you received: 0
10 years 6 days ago #250579
by sebastienh@alkaonline.be
Replied by sebastienh@alkaonline.be on topic How to set new status to order
Hello,
sorry to dig up an "old" post bu I also need to update the status of an order programmatically.
The code you gave works fine but I'd like to send a mail (as in the "default" statut changing window) to the customer.
At least the default "command mail" with a subject like "Your order is now confirmed".
Is there a way to use the API to do that?
Thanks in advance
sorry to dig up an "old" post bu I also need to update the status of an order programmatically.
The code you gave works fine but I'd like to send a mail (as in the "default" statut changing window) to the customer.
At least the default "command mail" with a subject like "Your order is now confirmed".
Is there a way to use the API to do that?
Thanks in advance
Please Log in or Create an account to join the conversation.
Time to create page: 0.185 seconds