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.