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

Hello.

I have a reatime payment processor in my shop, pireus.php..

I want to send an email to me as an admin when an order becomes F or N in the database.

How can I manage this?

Hello.

I have a reatime payment processor in my shop, pireus.php..

I want to send an email to me as an admin when an order becomes F or N in the database.

How can I manage this?

If you have CS-Cart version 4.3.x, you can find the "Notify orders department" setting http://joxi.ru/EA4KPgVtQqeQ2bon the status editing page. If you use version 4.4x, activate the necessary template in Design/Email templates.

Incmplete - default order status. It means that the system does not use the fn_change_order_status function when the order is plcaed to the database with this status. Additional code modifications are required to enable such notifications

Thanks to both of you.

The issue I am trying to solve is this:

I had a customer last week that order a product, payed throuth the bank and the order never showd up in the admin panel

The record was only in the database ?:orders with status='N'.

the payment was received succesfully by me.

So, I want some kind of control in the code that will ensure me that I will never miss an order like this in the future.

I am thinking of an "if" statement that will send an email to me when an order is 'N' or 'F'.

Should I put this in the pireus.php or somewhere else?

Incomplete orders can be found on the Orders -> View Orders -> Gear icon at the top -> Incomplete orders page

Yes, I know this. But I want to be notified when an order is 'F' or 'N'.

Am I not clear enough? :/

You can use the create_order hook in the fn_update_order function to create additional notification for each new order

create_order or the mailer::sendmail()

to send an email when an order is N or F?

Since emails are not sent for the N status, it is better to use the create_order hook

I see.

Although, if I want to create a mailer::sendmail to send me email in an if statement, how is the proper way to write the code?

For example:

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'));

If I want to send a text, what should I change?

Pff I think I cannot explain this.

What would be the right code that sends an email to me with a text for example?

Thanks a lot

I would recommend you to fix your payment processor. Because it is not good when the order is incomplete.What you customers will see? They pay for the products but do not see the order. Also if you fix the payment method, you will see the order in the orders list, change statuses and receive e-mails correctly.

I would recommend you to fix your payment processor. Because it is not good when the order is incomplete.What you customers will see? They pay for the products but do not see the order. Also if you fix the payment method, you will see the order in the orders list, change statuses and receive e-mails correctly.

Yeah, I agree and I will fix this.

But in case something will be missed again in the future, I want to be notified in time.

I am chasing that 1% chance of something going wrong..

Simplest way is to correct script of your payment processors and change status of new order to Open before the payment is made (paypal works in this way)

    if ($order_info['status'] == STATUS_INCOMPLETED_ORDER) {
        fn_change_order_status($order_id, 'O', '', true);
    }

As a result, notification will be send to admin and customer and order will be displayed in the general list of orders

Simplest way is to correct script of your payment processors and change status of new order to Open before the payment is made (paypal works in this way)

    if ($order_info['status'] == STATUS_INCOMPLETED_ORDER) {
        fn_change_order_status($order_id, 'O', '', true);
    }

As a result, notification will be send to admin and customer and order will be displayed in the general list of orders

Nice one!

But, instead of changing the order status, what will be the code to send an email to me?

Without using .tpl files, just a text that says that this order with her No is uncompleted for some reason.

E.g.

"Order # 123 is uncompleted, please check it out."

What will be the structure of Mailer::sendMail ??

Nice one!

But, instead of changing the order status, what will be the code to send an email to me?

Without using .tpl files, just a text that says that this order with her No is uncompleted for some reason.

E.g.

"Order # 123 is uncompleted, please check it out."

What will be the structure of Mailer::sendMail ??

Unfortunately, you cannot use default CS-Cart functions which are used to send emails without templates

So, you are saying that if I create a .tpl file with the message I want, it will work. Right?

So, you are saying that if I create a .tpl file with the message I want, it will work. Right?

Why not? It will work, just put template to the correct directory

I'll give it a try then. I'll try to understsand better the mailer code and specify the directory I should put the template in. I think I will seek for some advice again but I'll do my best so as not to bother you!

:-)

Thank you very much, your help in the forum is valuable!

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