Page 1 of 1

Do an action after order completed

Posted: Thu Oct 18, 2018 10:28 pm
by totinaples
Hello everyone
I have an Opencart 2.0.1.1 shop and I'm trying to execute a POST action after an order is completed. Practically I want to send the order shipping informations (name, address, etc...) to my external order management tool that accepts some REST API. I was able to send some static infos by editing the controller/checkout/success file. Anyway I have some strange problems of visualization due to an error regarding breadcrumbs and other unknown(for me) things. I read a lot of things and I think I should do something with the model/checkout/order file but I tried many things without success.

Does anyone know what should I try?
Thanks for your help


OC Version: 2.0.1.1
Theme: Journal2

Re: Do an action after order completed

Posted: Sun Oct 21, 2018 1:38 am
by straightlight
I would consider to upgrade OC at this point since recent OC versions uses a feature called: events which is way more easier to achieve the goal of your request. Even with a use of an API, it could still be adapted on that level.

Re: Do an action after order completed

Posted: Sun Oct 21, 2018 11:42 am
by danishmagic
I think you should perform this action on success page, and this can be possible using Javascript/Ajax + php, you need to create a form on success page which will be auto submitted using JavaScript/Ajax on window load and your information will be sent to the page you are looking for.

I hope it helps.

Re: Do an action after order completed

Posted: Sun Oct 21, 2018 7:48 pm
by straightlight
Even though an Ajax request would be created, the order_id key gets unset in the success page. With an event, the output can be used from a module called from the database in order to create last action events before the order_id gets officially unset.