CS-Cart: Hook for checking out

902 views Asked by At

I am new to CS Cart , and I want to run specific function after user complete check out process.

Any help would be appreciated.

Thanks

2

There are 2 answers

0
Fariz Aliyev On

you can use checkout_place_orders_pre_route function hook for doing something before routing order complete page.

fn_set_hook('checkout_place_orders_pre_route', $cart, $auth, $params);
0
Kiriakos Grhgoriadhs On

The post is very old, but I guess if someone else want to do the same.. First of all, what is your CS-Cart version?

There are more than one ways to do this. I will try to explain one of them: Go to "Manage Addons" and make sure you have already Installed and Activated the "My changes" addon.

The checkout process completed in this tpl file path:

design/themes/responsive/templates/views/checkout/complete.tpl

*responsive = your_theme if you have another theme already installed

Inside this file, there is a hook at the end of the tpl file named:

{hook name="checkout:order_confirmation"}

Thus, you could go over this path:

design/themes/responsive/templates/addons/my_changes

and create the folder: checkout

Inside this folder, create a tpl file with the name: order_confirmation.post.tpl

In this empty tpl file, you could write your custom function or whatever you may want (like html, foreach loops and so on)
Pay attention that you should use smarty PHP inside these tpl files, in general

Now, go to this path:

app/addons/my_changes/func.php

Inside this file you could have your custom function.

For example:

function fn_my_changes_my_checkout() {
    //some code here
    return "Hello";
}

In file order_confirmation.post.tpl you created earlier, you could now call your custom function my_checkout like this:

{assign var="my_variable" value=fn_my_changes_my_checkout}
{$my_variable} // this will echo "Hello", meaning the returned value of your custom function