Send Email For Status 'f' Or 'n' In Cscart_Orders

Also how can we pass the variable / condition

        if ($notify_user == true) {
}
to the mail/templates/orders/order_notification.tpl file to run some code based on the true value from tpl

Something like this? I am not sure..

{assign var="notify_user" value=$notify_user}

But u need to pass the value from php to smarty template first so it means we need to store it in a variable which is being passed to the smarty

If you put this in your php file?

Tygh::$app['view']->assign('notify_user', $notify_user);

hi i have also a question on similar lines want to mark an email bcc to an address when the order gets completed.

How can i add this condition in the code below ?

Mailer::sendMail(array(
					'to' => 'company_users_department',
					'from' => 'company_users_department',
					'reply_to' => $user_data['email'],
					'data' => array(
						'user_data' => $user_data,
					),
					'tpl' => 'profiles/activate_profile.tpl',
					'company_id' => $user_data['company_id']
				), 'A', Registry::get('settings.Appearance.backend_default_language'));

need to add 'bcc' => 'test@example.com',

when the status is completed.

I am not sure how can i add this on conditional basis.

Also how can we pass the variable / condition

        if ($notify_user == true) {
}
to the mail/templates/orders/order_notification.tpl file to run some code based on the true value from tpl

Check the fn_order_notification function (app/functions/fn.cart.php)

You should change

            $mailer->send(array(
                'to' => $order_info['email'],
                'from' => 'company_orders_department',
                'data' => array(
                    'order_info' => $order_info,
                    'shipments' => $shipments,
                    'tracking_numbers' => $tracking_numbers,
                    'shipping_methods' => $shipping_methods,
                    'order_status' => $order_status,
                    'payment_method' => $payment_method,
                    'profile_fields' => $profile_fields,
                    'profields' => $profields,
                    'secondary_currency' => $secondary_currency,
                    'take_surcharge_from_vendor' => $take_surcharge_from_vendor
                ),
                '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'],
            ), 'C', $order_info['lang_code']);

to

            $bcc = '';
            if ($order_info['status'] == 'C') {
                $bcc = 'test@example.com';
            }
            $mailer->send(array(
                'to' => $order_info['email'],
                'from' => 'company_orders_department',
                'bcc' => $bcc,
                'data' => array(
                    'notify_user' => true,
                    'order_info' => $order_info,
                    'shipments' => $shipments,
                    'tracking_numbers' => $tracking_numbers,
                    'shipping_methods' => $shipping_methods,
                    'order_status' => $order_status,
                    'payment_method' => $payment_method,
                    'profile_fields' => $profile_fields,
                    'profields' => $profields,
                    'secondary_currency' => $secondary_currency,
                    'take_surcharge_from_vendor' => $take_surcharge_from_vendor
                ),
                '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'],
            ), 'C', $order_info['lang_code']);

I want to create a new tpl file as an email that I will send to my customer as a notification about something.

The path is:

"design\backend\mail\templates\profiles\disabled_product.tpl"

The problem I encounter is that I don't have idea which is the way to pass variables from my php file into the tpl in order to send this tpl as an email.

My php file is profiles.pre.php in which I am doing some checks and if a product fullfills some criteria< then an email goes to my customer.

Can someone guide me plz?

Thanks a lot

I want to create a new tpl file as an email that I will send to my customer as a notification about something.

The path is:

"design\backend\mail\templates\profiles\disabled_product.tpl"

The problem I encounter is that I don't have idea which is the way to pass variables from my php file into the tpl in order to send this tpl as an email.

My php file is profiles.pre.php in which I am doing some checks and if a product fullfills some criteria< then an email goes to my customer.

Can someone guide me plz?

Thanks a lot

Please check the following part of code from my previous message

                'data' => array(
                    'notify_user' => true,
                    'order_info' => $order_info,
                    'shipments' => $shipments,
                    'tracking_numbers' => $tracking_numbers,
                    'shipping_methods' => $shipping_methods,
                    'order_status' => $order_status,
                    'payment_method' => $payment_method,
                    'profile_fields' => $profile_fields,
                    'profields' => $profields,
                    'secondary_currency' => $secondary_currency,
                    'take_surcharge_from_vendor' => $take_surcharge_from_vendor
                ),

it means that the following variables will be available in the template:

{$notify_user}

{$order_info}

etc

Please check the following part of code from my previous message

                'data' => array(
                    'notify_user' => true,
                    'order_info' => $order_info,
                    'shipments' => $shipments,
                    'tracking_numbers' => $tracking_numbers,
                    'shipping_methods' => $shipping_methods,
                    'order_status' => $order_status,
                    'payment_method' => $payment_method,
                    'profile_fields' => $profile_fields,
                    'profields' => $profields,
                    'secondary_currency' => $secondary_currency,
                    'take_surcharge_from_vendor' => $take_surcharge_from_vendor
                ),

it means that the following variables will be available in the template:

{$notify_user}

{$order_info}

etc

Really? This will be a huge help I think!

I am going to try this, thank you very much!!!