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

#   Simple question

##

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

Less More

- Posts: 58
- Thank you received: 2
-
-

13 years 10 months ago [\#83315](#83315) by [mcruip](/forum/user/12482-mcruip "View mcruip's Profile")  *[Simple question](/forum/2-general-talk-about-hikashop/77021-simple-question#83315 "Hi, We need to add a small code (for the admin) after an order status has been changed to &quot;confirmed&quot; (meaning payment was ok after order created) so that we can insert/update a custom db table with some data.  The question is - which is the best file to place our code? administrator/com&#95;hikashop/controllers/user.php or there's another place where the system performs this task of changing the order status?  Thanks in advance for your help. Cheers M")* was created by *[mcruip](/forum/user/12482-mcruip "View mcruip's Profile")*

Hi,
We need to add a small code (for the admin) after an order status has been changed to "confirmed" (meaning payment was ok after order created) so that we can insert/update a custom db table with some data.

The question is - which is the best file to place our code? administrator/com_hikashop/controllers/user.php or there's another place where the system performs this task of changing the order status?

Thanks in advance for your help.
Cheers
M

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

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26400
- Thank you received: 4079
-
- [](http://obsi.dev)
-

13 years 10 months ago [\#83402](#83402) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Simple question](/forum/2-general-talk-about-hikashop/77021-simple-question#83402 "Hi, We need to add a small code (for the admin) after an order status has been changed to &quot;confirmed&quot; (meaning payment was ok after order created) so that we can insert/update a custom db table with some data.  The question is - which is the best file to place our code? administrator/com&#95;hikashop/controllers/user.php or there's another place where the system performs this task of changing the order status?  Thanks in advance for your help. Cheers M")*

Hi,

The best place is a plugin with the trigger "onAfterOrderUpdate".
By creating a plugin you could be able to update HikaShop without loosing your modifications (and so, your feature).

[ www.hikashop.com/en/support/documentatio...l#onAfterOrderUpdate](http://www.hikashop.com/en/support/documentation/62-hikashop-developer-documentation.html#onAfterOrderUpdate)

The $order object contains "$order-&gt;old", so you can check for order status modification thanks to "$order-&gt;order_status" and "$order-&gt;old-&gt;order_status".
If "$order-&gt;order_status" is empty or not set it means that the order has been modified by the status is not modified.

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

The following user(s) said Thank You: [mcruip](/forum/user/12482-mcruip "View mcruip's Profile")

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

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

Less More

- Posts: 58
- Thank you received: 2
-
-

13 years 10 months ago [\#83407](#83407) by [mcruip](/forum/user/12482-mcruip "View mcruip's Profile")  Replied by *[mcruip](/forum/user/12482-mcruip "View mcruip's Profile")* on topic *[Simple question](/forum/2-general-talk-about-hikashop/77021-simple-question#83407 "Hi, We need to add a small code (for the admin) after an order status has been changed to &quot;confirmed&quot; (meaning payment was ok after order created) so that we can insert/update a custom db table with some data.  The question is - which is the best file to place our code? administrator/com&#95;hikashop/controllers/user.php or there's another place where the system performs this task of changing the order status?  Thanks in advance for your help. Cheers M")*

Hi Jerome,

Thank you very much for your feedback. Yes, I was pointing there but I just wanted to make sure it wouldn't break any of the functionalities of the payment system. I just need to add a flag to a db table so it's fairly simple and easy.

Once again, thanks!!

Cheers
McRui

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

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

Less More

- Posts: 58
- Thank you received: 2
-
-

13 years 9 months ago [\#88866](#88866) by [mcruip](/forum/user/12482-mcruip "View mcruip's Profile")  Replied by *[mcruip](/forum/user/12482-mcruip "View mcruip's Profile")* on topic *[Simple question](/forum/2-general-talk-about-hikashop/77021-simple-question#88866 "Hi, We need to add a small code (for the admin) after an order status has been changed to &quot;confirmed&quot; (meaning payment was ok after order created) so that we can insert/update a custom db table with some data.  The question is - which is the best file to place our code? administrator/com&#95;hikashop/controllers/user.php or there's another place where the system performs this task of changing the order status?  Thanks in advance for your help. Cheers M")*

Hi Jerome,
Has there been any changes in the changestatus() in 2.1? I'm asking this because the plugin I've made now only works if I change the order status manually, which means that when the order status changes automatically, for instance when the payment is confirmed, the plugin no longer triggers. Possibly any changes in this changestatus system on 2.1 that I'm not aware.
Thanks
M

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzc3MDIxLXNpbXBsZS1xdWVzdGlvbj90bXBsPW1hcmtkb3du) 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?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86541
- Thank you received: 14304
-
-

13 years 9 months ago [\#89051](#89051) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Simple question](/forum/2-general-talk-about-hikashop/77021-simple-question#89051 "Hi, We need to add a small code (for the admin) after an order status has been changed to &quot;confirmed&quot; (meaning payment was ok after order created) so that we can insert/update a custom db table with some data.  The question is - which is the best file to place our code? administrator/com&#95;hikashop/controllers/user.php or there's another place where the system performs this task of changing the order status?  Thanks in advance for your help. Cheers M")*

Hi,

That trigger is still called when orders are confirmed automatically in the 2.1. The $order variable should roughly be the same than on 2.0 with only a few more attributes.

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

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

Less More

- Posts: 58
- Thank you received: 2
-
-

13 years 9 months ago [\#89053](#89053) by [mcruip](/forum/user/12482-mcruip "View mcruip's Profile")  Replied by *[mcruip](/forum/user/12482-mcruip "View mcruip's Profile")* on topic *[Simple question](/forum/2-general-talk-about-hikashop/77021-simple-question#89053 "Hi, We need to add a small code (for the admin) after an order status has been changed to &quot;confirmed&quot; (meaning payment was ok after order created) so that we can insert/update a custom db table with some data.  The question is - which is the best file to place our code? administrator/com&#95;hikashop/controllers/user.php or there's another place where the system performs this task of changing the order status?  Thanks in advance for your help. Cheers M")*

Hi Nicolas,
Thanks for the reply. Have to check it because I've not made any changes and in fact it no longer triggers unless, as I mentioned, I change the order status in the administration.
Thanks
M

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzc3MDIxLXNpbXBsZS1xdWVzdGlvbj90bXBsPW1hcmtkb3du) 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.050 seconds

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