Page 1 of 1

Call function/add own code after Order.

Posted: Mon Mar 05, 2018 10:42 pm
by rogal127
Hi, i'm working on Open Cart 3.0.2.0.
I want to call my own function after someone buy a product from my store. Where i can call this function? I tried to put the test code in catalog/model/checkout/order.php in addOrder and addOrderHistory methods, but it doesn't work.. Can anyone know in which file and method i should put my own code?

There is piece of my test code:

Code: Select all

 <?php
class ModelCheckoutOrder extends Model {
	public function addOrder($data) {
		//TEST
		file_put_contents('my_directory/test.txt', 'test');
		...
		 
Edit: I know that in older versions was Confirm method i Checkout Model, and there u could pass your code, but it disappeared in new versions.

I can put my code in catalog/controller/success.php, but i need to get and pass informations about all ordered products. Any ideas?

Best regards.

Re: Call function/add own code after Order.

Posted: Tue Mar 06, 2018 12:06 am
by straightlight
In the catalog/controller/event folder and on your event database table.
For emails: catalog/controller/mail folder and the same for the event database table.