At sale completion-get order details, send to a member database

My client is selling a membership as a product using CS-Cart.

So I need to automatically capture some of the order details when purchase is complete: First and last name, email, and using php, send the data to a new membership database where a member record will be created using this information.

I have 5 clients using CS-cart, but never created a plugin that could do this. The documentation is for how to create a twitter plugin. Being new at plugins, I assume this is what would need to be done. Don't know where or how to invoke it at the end of the purchase process after they click submit order.

I'd be willing to share the final result if any would be kind enough to jump in with me.


You need to utilize a checkout.pre.php file to hook into the process. In there check for $mode == 'complete' and add you functionality inside that if statement. This will fire only when an order is complete but it will execute before the 'Your Order is Placed' page is loaded. This allows you to capture any return data from the membership service and display it on the purchase confirmation page.

Your other option is to utilize a func.php file and hook into the fn_place_order function and modify it there.

Thanks you so much for responding to the post.

Being a newbie at this part of CS-Cart, I don't know where to start.

It looks like CS has 4 checkout.pre.php files, each associated with an addon:

-Access restrictions

-Age verification

-Buy together

-News and emails.

None of those have " $mode == 'complete' " in them

checkout.php is the only file in the store that has this, and its used to purge undeliverable products.

So I assume I'd have to create an addon. Saw the sample and Twitter tutorials, but haven't a clue as to get a plugin to do this, how to add the code, and how/where to tell CS to hook into the process.

If you have time, otherwise, thank you again for the initial response.

Best of regards,


Just do it within the my_changes addon unless you really have a need to keep these changes separate from others.

When controllers are “run”, they are fun in Priority order (specified in the addon.xml file) and controllers (addons) of equal priority are then executed in alphabetical order. When a controller is run (like “checkout”) cs-cart goes through all the addons looking first for a addons//controllers/customer/checkout.pre.php file. If so it executes them in the order as described above.

The “core controller” (controllers/checkout.php in this case) is then run. Following that, all the addons are searched looking for a addons//controllers/customer/ file and if found, they are executed in the order described above.

Note that your addon must differentiate between a POST and a GET method. You should always use a return for the controller of either array(CONTROLLER_STATUS_OK) or array(CONTROLLER_STATUS_REDIRECT, ''.