Simple question

  • Posts: 58
  • Thank you received: 2
11 years 11 months ago #83315

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 or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 10 months ago #83402

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

The $order object contains "$order->old", so you can check for order status modification thanks to "$order->order_status" and "$order->old->order_status".
If "$order->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 & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: mcruip

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

  • Posts: 58
  • Thank you received: 2
11 years 10 months ago #83407

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 or Create an account to join the conversation.

  • Posts: 58
  • Thank you received: 2
11 years 9 months ago #88866

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 or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
11 years 9 months ago #89051

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 or Create an account to join the conversation.

  • Posts: 58
  • Thank you received: 2
11 years 9 months ago #89053

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 or Create an account to join the conversation.

Time to create page: 0.062 seconds
Powered by Kunena Forum