Skip to main content

How to set new status to order

More
10 years 2 months ago #246487 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?

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

More
10 years 2 months ago #246491 by nicolas
Hi,

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);
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.
The following user(s) said Thank You: Sergey Romanov

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

More
10 years 2 months ago #246532 by Sergey Romanov
Thank you Nikolas. This is update of old order, not create new one?

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

More
10 years 2 months ago #246544 by nicolas
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 :)

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

More
10 years 6 days ago #250579 by sebastienh@alkaonline.be
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

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

Time to create page: 0.185 seconds
Powered by Kunena Forum