Changing The "from" In The Email Notification Of New Order

Hi,

In all previous versions, following help we got from cs-cart help desk, we altered the code with in app/function/fn-cart.php so that email notification will arrive to our orders department with the email of the customer in the "from" (rather than our own email).

This helped us with the integration with our customer service ticket system (the ticket was opened with the email of the customer, so it was easy to follow and reply.

This is how the code looked like (marked in bold red below).

// Notify order department
if ($notify_department == true) {
// Translate descriptions to admin language
fn_translate_products($order_info['products'], '', Registry::get('settings.Appearance.backend_default_language'), true);
$payment_method = array();
if ($payment_id) {
$payment_method = fn_get_payment_data($payment_id, $order_info['order_id'], Registry::get('settings.Appearance.backend_default_language'));
}

fn_add_user_data_descriptions($order_info, Registry::get('settings.Appearance.backend_default_language'));
$mailer->send(array(
'to' => 'default_company_orders_department',
'from' => $order_info['email'],
'reply_to' => $order_info['email'],
'data' => array(
'order_info' => $order_info,
'shipments' => $shipments,
'use_shipments' => $use_shipments,
'order_status' => fn_get_status_data(
$order_info['status'],
STATUSES_ORDER,
$order_info['order_id'],
Registry::get('settings.Appearance.backend_default_language'),
$order_info['company_id']
),
'payment_method' => $payment_method,
'status_settings' => $status_settings,
'profile_fields' => fn_get_profile_fields('I', '', Registry::get('settings.Appearance.backend_default_language')),
'secondary_currency' => $secondary_currency
),
'template_code' => $email_template_name,
'tpl' => 'orders/order_notification.tpl', // this parameter is obsolete and is used for back compatibility
'company_id' => $order_info['company_id'],
), 'A', Registry::get('settings.Appearance.backend_default_language'));
}

in the latest version of CS CART the code is no longer within the fncart file.

I spent hours looking for its new location with no success.

can any one help with where the code for sending email notification about new order to the orders departments is located now?

Thanks

Hello

Look at this file

/app/schemas/notifications/events.php

Best regards

Robert

Thanks! It works :-)

Hello

You are welcome :)

Best regards

Robert

In the mentioned file try to replace

        UserTypes::ADMIN => [
            MailTransport::getId() => MailMessageSchema::create([
                'area'            => 'A',
                'from'            => 'default_company_orders_department',
with
        UserTypes::ADMIN => [
            MailTransport::getId() => MailMessageSchema::create([
                'area'            => 'A',
                'from'            => 'DataValue::create('order_info.email'),

(!) Not tested