Do Something When A New Customer Registers Or When A New Order Is Placed

Hello everyone,

I need to save customer/order data to a remote database tables when a new customer registers or when a new order is placed.

Any idea where to start?

Thank you


Just export the required info.


If you need this in real-time, then you will have to hook into each of those events and then send the data in the expected format to the destination. It is custom work based on what info you want to send and how you want to send it.

Thanks for the response tbirnseth. Just wondering where to find a list of available cs-cart hooks!!

May be of use to you

Check hooks in the following functions:

- fn_update_user (app/functions/fn.users.php)

- fn_place_order (app/functions/fn.cart.php)

Thank you very much, that was very helpful.

We are glad to help you

Sorry but I need help again.

I created the following plugin, a test one just to see if it works but it doesn't seem to be working. I tried to register as a new customer few times after installing and activating this addon but nothing was saved in the database table.


if ( !defined(‘AREA’) ) { die(‘Access denied’); }




if ( !defined(‘AREA’) ) { die(‘Access denied’); }

function fn_export_customer_to_erp_update_user_pre($user_id, $user_data, &$auth, $ship_to_another, $notify_user){
// Some test to make sure addon is being called. Tables is already created
$name = rand(90,9999);
db_query(‘INSERT INTO export_customer_to_erp_addon_data(name) VALUES ($name)’);



    Export Customers to ERP
    Export customers from CS-Cart to client ERP system


Try to change

db_query(‘INSERT INTO export_customer_to_erp_addon_data(name) VALUES ($name)’);
db_query(“INSERT INTO export_customer_to_erp_addon_data(name) VALUES (‘$name’)”);
The VALUE $name must be in single quotes. You might be able to see the error in your Logs if you have DB error loggin enabled.

Alternatively in cs-cart fashion/style it would be written as:
$db_data = array(‘name’ => $name);
db_query(“INSERT INTO export_customer_to_erp_addon_data ?e”, $db_data);
Which will do the appropriate quoting for you. Field is the index of the array and the VALUE is the value.

You might also want to be sure your addon is Active. Usually one has a

in your addon.xml. Otherwise it will be installed as disabled.

Hi tbirnseth,

I followed all the instructions but nothing happened. Seems like the addon is never been called!

Did you confirm that it is listed as Active?
Otherwise, all else appears correct.

Yes I did, that's odd.

Please use


instead of


Perfect. Thanks eComLabs. That worked :)

But just wondering why there isn't a update_user_post function!

I was hoping to be able to get the user data after he registers!

Sorry forget my previous message. I managed to get the user data for new registrations by using.

// code here

Thanks again

There is the update_profile hook at the end of this function:

You can also use it

Perfect. Thanks a lot

You are welcome! :)

Okay guys back to this question, how do I get the newly inserted user ID in the "update_user_pre" function??