[Skip to main content](#vessel-content)

#   How to set new status to order

##

- **[Sergey Romanov](/forum/user/5439-sergey-romanov "View Sergey Romanov's Profile")**
- [![Sergey Romanov's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/5439-sergey-romanov "View Sergey Romanov's Profile") Topic Author
- [ Offline](/forum/user/5439-sergey-romanov)

Less More

- Posts: 38
- Thank you received: 2
-
-

10 years 2 months ago [\#246487](#246487) by [Sergey Romanov](/forum/user/5439-sergey-romanov "View Sergey Romanov's Profile")  *[How to set new status to order](/forum/31-development/885777-how-to-set-new-status-to-order#246487 "-- 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&#95;status field in DB table? Any cross reference tables?")* was created by *[Sergey Romanov](/forum/user/5439-sergey-romanov "View Sergey Romanov's Profile")*

-- 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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2RldmVsb3BtZW50Lzg4NTc3Ny1ob3ctdG8tc2V0LW5ldy1zdGF0dXMtdG8tb3JkZXI/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86289
- Thank you received: 14265
-
-

10 years 2 months ago [\#246491](#246491) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How to set new status to order](/forum/31-development/885777-how-to-set-new-status-to-order#246491 "-- 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&#95;status field in DB table? Any cross reference tables?")*

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-&gt;order_id = XXX; $order-&gt;order_status = 'YYY'; $orderClass-&gt;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](/forum/user/5439-sergey-romanov "View Sergey Romanov's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2RldmVsb3BtZW50Lzg4NTc3Ny1ob3ctdG8tc2V0LW5ldy1zdGF0dXMtdG8tb3JkZXI/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Sergey Romanov](/forum/user/5439-sergey-romanov "View Sergey Romanov's Profile")**
- [![Sergey Romanov's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/5439-sergey-romanov "View Sergey Romanov's Profile") Topic Author
- [ Offline](/forum/user/5439-sergey-romanov)

Less More

- Posts: 38
- Thank you received: 2
-
-

10 years 2 months ago [\#246532](#246532) by [Sergey Romanov](/forum/user/5439-sergey-romanov "View Sergey Romanov's Profile")  Replied by *[Sergey Romanov](/forum/user/5439-sergey-romanov "View Sergey Romanov's Profile")* on topic *[How to set new status to order](/forum/31-development/885777-how-to-set-new-status-to-order#246532 "-- 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&#95;status field in DB table? Any cross reference tables?")*

Thank you Nikolas. This is update of old order, not create new one?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2RldmVsb3BtZW50Lzg4NTc3Ny1ob3ctdG8tc2V0LW5ldy1zdGF0dXMtdG8tb3JkZXI/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86289
- Thank you received: 14265
-
-

10 years 2 months ago [\#246544](#246544) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How to set new status to order](/forum/31-development/885777-how-to-set-new-status-to-order#246544 "-- 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&#95;status field in DB table? Any cross reference tables?")*

Hi,

That's right. If you remove the line:
$order-&gt;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 ![:)](/media/kunena/emoticons/8.png ":)")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2RldmVsb3BtZW50Lzg4NTc3Ny1ob3ctdG8tc2V0LW5ldy1zdGF0dXMtdG8tb3JkZXI/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[sebastienh@alkaonline.be](/forum/user/45180-sebastienh-alkaonline-be "View sebastienh@alkaonline.be's Profile")**
- [![sebastienh@alkaonline.be's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar45180.png)](/forum/user/45180-sebastienh-alkaonline-be "View sebastienh@alkaonline.be's Profile")
- [ Offline](/forum/user/45180-sebastienh-alkaonline-be)

Less More

- Posts: 14
- Thank you received: 0
-
-

10 years 1 month ago [\#250579](#250579) by [sebastienh@alkaonline.be](/forum/user/45180-sebastienh-alkaonline-be "View sebastienh@alkaonline.be's Profile")  Replied by *[sebastienh@alkaonline.be](/forum/user/45180-sebastienh-alkaonline-be "View sebastienh@alkaonline.be's Profile")* on topic *[How to set new status to order](/forum/31-development/885777-how-to-set-new-status-to-order#250579 "-- 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&#95;status field in DB table? Any cross reference tables?")*

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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2RldmVsb3BtZW50Lzg4NTc3Ny1ob3ctdG8tc2V0LW5ldy1zdGF0dXMtdG8tb3JkZXI/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop- Install &amp; Update- Product &amp; Category Display- Content Creation- Sales and Orders- - Orders management- - Reports &amp; Statistics- Customers- Checkout- Payment Methods- Shipping Methods- Import &amp; Export (CSV, XLS…)- Specific Features- - Affilation- - Taxes- - Wishlist- - Vote- - Carousel &amp; Slider- - Mass Actions- - Filters &amp; Search- - Discount &amp; Coupon- - Feature Request- Integrations- Showcase- General Talk about HikaShop- Development- - HikaShop 3.0 Beta- Translation- Commercial Jobs HikaShop Components- HikaMarket- - Market: Feature requests- - Market: How to?- - Market: Bug Report- HikaSerial- - General talk about HikaSerial- - Serial: Bug Report- - Serial: How to?- - Support en Français de HikaSerial (French Support)- - HikaSubscription- HikaAuction- - Auction: Feature requests- - Auction: How to?- - Auction: Bug report Hikashop around the world- Support en Français (French Support)- Russian- - FAQ. Курс выживания с Hikashop. Частые вопросы и о- - Расширения Hikashop- - Наши сайты на Hikashop- 日本語版サポート(Japanese Support)- Thai- German Archives- Bug Report- How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.164 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)

[](#top)
