New Shippment - Notify Department

I would like to add a checkbox to the new shipment window so that when a shipment notification email is sent the orders dept is sent the same email as the customer.

In new_shipment.tpl I have tried adding a checkbox with id="shipment_notify_department" emulating the customer checkbox but this is not doing the trick.

Any suggestions?

I would like to add a checkbox to the new shipment window so that when a shipment notification email is sent the orders dept is sent the same email as the customer.

In new_shipment.tpl I have tried adding a checkbox with id="shipment_notify_department" emulating the customer checkbox but this is not doing the trick.

Any suggestions?

Hello!

Firstly, open the design/backend/templates/views/shipments/components/new_shipment.tpl and add this code:

{__("send_shipment_notification_to_department")}

after this part:

{__("send_shipment_notification_to_customer")}

Then find fn_update_shipment function in app/functions/fn.cart.php and add this code:

if (!empty($force_notification['A'])) {
    $shipment = array(
        'shipment_id' => $shipment_id,
        'timestamp' => $shipment_data['timestamp'],
        'shipping' => db_get_field('SELECT shipping FROM ?:shipping_descriptions WHERE shipping_id = ?i AND lang_code = ?s', $shipment_data['shipping_id'], $order_info['lang_code']),
        'tracking_number' => $shipment_data['tracking_number'],
        'carrier' => $shipment_data['carrier'],
        'comments' => $shipment_data['comments'],
        'items' => $shipment_data['products'],
    );
Mailer::sendMail(array(
    'to' => 'default_company_orders_department',
    'from' => 'company_orders_department',
    'data' => array(
        'shipment' => $shipment,
        'order_info' => $order_info,
    ),
    'tpl' => 'shipments/shipment_products.tpl',
    'company_id' => $order_info['company_id'],
), 'C', $order_info['lang_code']);

}

after this:

if (!empty($force_notification['C'])) {
    $shipment = array(
        'shipment_id' => $shipment_id,
        'timestamp' => $shipment_data['timestamp'],
        'shipping' => db_get_field('SELECT shipping FROM ?:shipping_descriptions WHERE shipping_id = ?i AND lang_code = ?s', $shipment_data['shipping_id'], $order_info['lang_code']),
        'tracking_number' => $shipment_data['tracking_number'],
        'carrier' => $shipment_data['carrier'],
        'comments' => $shipment_data['comments'],
        'items' => $shipment_data['products'],
    );
Mailer::sendMail(array(
    'to' => $order_info['email'],
    'from' => 'company_orders_department',
    'data' => array(
        'shipment' => $shipment,
        'order_info' => $order_info,
    ),
    'tpl' => 'shipments/shipment_products.tpl',
    'company_id' => $order_info['company_id'],
), 'C', $order_info['lang_code']);

}

Also you will need to add "send_shipment_notification_to_department" language variable.

Wouldnt it be easier to add the order departments in bcc ?

Thanks Oleg

Wouldnt it be easier to add the order departments in bcc ?

Unfortunately default mailer class does not support bcc. It will be required to modify the code of the mailer feature also

For those using older version of CS cart like myself app/functions/fn.cart.php does not exist so, I modified instructions from Oleg above to the following to send notification to admin email address;

controllers/admin/shipments.php

----------code added----------

$force_notification = fn_get_notification_rules($_REQUEST);
if (!empty($force_notification['A'])) {
$shipment = array(
'shipment_id' => $shipment_id,
'timestamp' => $shipment_data['timestamp'],
'shipping' => db_get_field('SELECT shipping FROM ?:shipping_descriptions WHERE shipping_id = ?i', $shipment_data['shipping_id']),
'tracking_number' => $shipment_data['tracking_number'],
'carrier' => $shipment_data['carrier'],
'comments' => $shipment_data['comments'],
'items' => $_REQUEST['shipment_data']['products'],
);

$view_mail->assign('shipment', $shipment);
$view_mail->assign('order_info', $order_info);
fn_send_mail(Registry::get('settings.Company.company_site_administrator'), Registry::get('settings.Company.company_orders_department'), 'shipments/shipment_products_subj.tpl', 'shipments/shipment_products.tpl', '', $order_info['lang_code']);
}

I would like to add the invoice shipping cost, invoice customer notes and invoice admin notes (details) to the shipping notification to admin.

Any thoughts on how to accomplish this on the above code.

You should edit the following template:

design/themes/THEME/mail/templates/shipments/shipment_products.tpl

Print content of the order_info array to find necessary data in it

{$order_info|fn_print_r}

Have tried adding this to controllers/admin/shipments.php in the code above but not doing the job.

{$lang.shipping_cost}:{include file="common_templates/price.tpl" value=$order_info.display_shipping_cost}
{if $order_info.notes}{$lang.notes}:{$order_info.notes|wordwrap:85:"\n":false|nl2br}{/if}
{if $order_info.details}{$lang.details}:{$order_info.details|wordwrap:85:"\n":false|nl2br}{/if}

Have tried adding this to controllers/admin/shipments.php in the code above but not doing the job.

{$lang.shipping_cost}:{include file="common_templates/price.tpl" value=$order_info.display_shipping_cost}
{if $order_info.notes}{$lang.notes}:{$order_info.notes|wordwrap:85:"\n":false|nl2br}{/if}
{if $order_info.details}{$lang.details}:{$order_info.details|wordwrap:85:"\n":false|nl2br}{/if}

Looks like you are adding SMARTY code to PHP file. Tpl file should be updated. And do not forget to clear cache