Make A Process Only At Admin Side When Placing An Order

Hello. I am looking for the way to making a process when placing an order. But this process must not add to the queue of customer order placing process. It should work only for/at admin side(when placing order). What I want to do is, I don't want to extend the process of customer order operation. Customer must not wait long to complete the ordering.



So, where and which function should I use?

hello,



you should use the “create_order” PHP hook (it is in “app/functions/fn.cart.php”):


fn_set_hook('create_order', $order);






for example, you may extend “my_changes” module:

  1. create “app/addons/my_changes/init.php” file with content:

```php


if (!defined('BOOTSTRAP')) { die('Access denied'); }

fn_register_hooks(
'create_order'
);

```

2. create "app/addons/my_changes/func.php" file with content:
```php

if (!defined('BOOTSTRAP')) { die('Access denied'); }

function fn_my_changes_create_order($order)
{
if (AREA == 'A') { // This condition would work only if you create order in admin panel
// your code
}
}
```
3. Make sure that the "My changes" add-on is activated (menu: Add-ons - Manage add-ons)

More details about PHP hooks [url="http://docs.cs-cart.com/4.2.x/addons/hooking/php_hooks.html"]here[/url]

Best regards,
WSA team

Hi. Is it same with this?



function fn_myaddon_place_order($order_id)
{
if (AREA == 'A') {
fn_print_die($order_id);
}
}


If not, what is the difference?

What I exactly want to do is, make a process at admin side when a customer place an order at frontend. I may use place order function to do processes when customer place an order, but it will extend the time of ordering for the customer. That's why, I am looking for a way liike this.

[quote]If not, what is the difference? [/quote]



the difference is that your PHP hook is called when order is created or edited, the “create_order” hook is called only during order creation.



if you need process to work during order placement in frontend, the condition by AREA must be removed and you may try to check this

Thanks a lot Damir. I got it.

you are welcome