Post by SynysterDory » Tue Mar 10, 2020 12:30 am

OC 3.0.3.2
I need to send two mails when adding an order history, this action have the option to notify the customer about the status of its order. Every time I approve an order I have to inform the customer, So...
In that action I need to send an extra email to a specific address. I tried to duplicate this action in:

Code: Select all

public/catalog/controller/mail/order.php

Code: Select all

//Test second mail
$secondmail = new Mail($this->config->get('config_mail_engine'));
$secondmail->parameter = $this->config->get('config_mail_parameter');
$secondmail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
$secondmail->smtp_username = $this->config->get('config_mail_smtp_username');
$secondmail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
$secondmail->smtp_port = $this->config->get('config_mail_smtp_port');
$secondmail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');

$mymail="test@mail.com";
$secondmail->setTo($mymail);
$secondmail->setFrom($from);
$secondmail->setSender(html_entity_decode($order_info['store_name'], ENT_QUOTES, 'UTF-8'));
$secondmail->setSubject(html_entity_decode(sprintf($language->get('text_subject'), $order_info['store_name'], $order_info['order_id']), 		ENT_QUOTES, 'UTF-8'));
$secondmail->setText($this->load->view('mail/order_edit', $data));
		
$secondmail->send();
$mail->send();
I hasn't achieved anything
Last edited by SynysterDory on Tue Mar 10, 2020 1:09 am, edited 1 time in total.

New member

Posts

Joined
Fri Nov 22, 2019 3:52 am
Location - México

Post by straightlight » Tue Mar 10, 2020 1:02 am

You'd need to post the complete solution.

- OC version
- Have you tried creating an event rather than editing core files? Wiki: https://github.com/opencart/opencart/wiki/Events-System

More information is needed.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by SynysterDory » Tue Mar 10, 2020 1:48 am

straightlight wrote:
Tue Mar 10, 2020 1:02 am
- Have you tried creating an event rather than editing core files? Wiki: https://github.com/opencart/opencart/wiki/Events-System
Never heard of it before

New member

Posts

Joined
Fri Nov 22, 2019 3:52 am
Location - México

Post by Quino » Tue Mar 10, 2020 2:28 am

No need to create a new class instance.
all you have to do is:

after

Code: Select all

		$mail->setText($this->load->view('mail/order_edit', $data));
		$mail->send();

add

Code: Select all

$mymail="test@mail.com";
$mail->setTo($mymail);
$mail->send();

New member

Posts

Joined
Fri Feb 28, 2020 1:19 am

Post by SynysterDory » Wed Mar 11, 2020 12:29 am

Quino wrote:
Tue Mar 10, 2020 2:28 am
No need to create a new class instance.
all you have to do is:

after

Code: Select all

		$mail->setText($this->load->view('mail/order_edit', $data));
		$mail->send();

add

Code: Select all

$mymail="test@mail.com";
$mail->setTo($mymail);
$mail->send();
Sounds good, doesn't work. I tried it but no email was sended, not even the original.
Thnks anyway

New member

Posts

Joined
Fri Nov 22, 2019 3:52 am
Location - México

Post by by mona » Wed Mar 11, 2020 1:04 am

Maybe I am misunderstanding or not reading properly but you know you have an additional alert option in settings?

Attachments

Screen-Shot-2020-03-10a.jpg

Screen-Shot-2020-03-10a.jpg (25.67 KiB) Viewed 3925 times


DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by SynysterDory » Wed Mar 11, 2020 1:20 am

by mona wrote:
Wed Mar 11, 2020 1:04 am
Maybe I am misunderstanding or not reading properly but you know you have an additional alert option in settings?
I know that, but it doesn't what I'm looking for.

New member

Posts

Joined
Fri Nov 22, 2019 3:52 am
Location - México

Post by Quino » Wed Mar 11, 2020 1:38 am

I believe the additional alerts only apply to new orders, not order updates.
I tried it but no email was sended, not even the original.
So even the original is not send?
Did you check your event table if the mail_alert event is there?

New member

Posts

Joined
Fri Feb 28, 2020 1:19 am

Post by SynysterDory » Thu Mar 12, 2020 12:51 am

Exactly
I believe the additional alerts only apply to new orders, not order updates.
Mmm... where?
If I delete the changes and update an order the original email is send it without issues
Did you check your event table if the mail_alert event is there?

New member

Posts

Joined
Fri Nov 22, 2019 3:52 am
Location - México

Post by straightlight » Thu Mar 12, 2020 12:56 am

SynysterDory wrote:
Thu Mar 12, 2020 12:51 am
Exactly
I believe the additional alerts only apply to new orders, not order updates.
Mmm... where?
If I delete the changes and update an order the original email is send it without issues
Did you check your event table if the mail_alert event is there?
In your admin - > extensions - > events page. Ensure all your mail_ prefixes are active on that location.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by by mona » Thu Mar 12, 2020 3:56 am

As Straightlight suggests check your events are set correctly.

As far as I understand your ‘issue’ you want to notify the customer and someone else (a fixed e-mail) that the order has changed status?

Order updates do send to the additional emails - depends on how you want to it thats all ..
Orders edit - you can change the order status there and this will also send to additional e-mails as well as the customer
Orders view - gives you the option to inform the customer or keep details 'in-house'

Attachments

Screen-Shot-2020-03-11.jpg

Screen-Shot-2020-03-11.jpg (44.57 KiB) Viewed 3800 times


DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by SynysterDory » Fri Mar 13, 2020 12:04 am

straightlight wrote:
Thu Mar 12, 2020 12:56 am
In your admin - > extensions - > events page. Ensure all your mail_ prefixes are active on that location.
Guess so
Image

New member

Posts

Joined
Fri Nov 22, 2019 3:52 am
Location - México

Post by straightlight » Fri Mar 13, 2020 12:06 am

What about your OC admin - > systems - > settings - > edit settings - > Mail tab's form (without password) and your cPanel > Email Accounts > << your_email >> > Manage > lower-left table settings (SSL)?

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by SynysterDory » Fri Mar 13, 2020 12:31 am

by mona wrote:
Thu Mar 12, 2020 3:56 am
As far as I understand your ‘issue’ you want to notify the customer and someone else (a fixed e-mail) that the order has changed status?
Basically, after an order is validated I update the status and attach them an invoice with relevant information, that pdf needs to be sended to someone else as well

New member

Posts

Joined
Fri Nov 22, 2019 3:52 am
Location - México

Post by SynysterDory » Fri Mar 13, 2020 1:08 am

straightlight wrote:
Fri Mar 13, 2020 12:06 am
What about your OC admin - > systems - > settings - > edit settings - > Mail tab's form (without password) and your cPanel > Email Accounts > << your_email >> > Manage > lower-left table settings (SSL)?
Image
and... the second one?

New member

Posts

Joined
Fri Nov 22, 2019 3:52 am
Location - México

Post by straightlight » Fri Mar 13, 2020 1:17 am

Using Gmail. Ok, now we're getting somewhere. Ever though on using the one from your host? In your cPanel host console (if using cPanel), click on: 'Email Accounts' > click on your desired email address listed > click on: Manage on the right side of the row. Then, at the corner-left down the page you'll see the SSL email configuration settings with the exception of your email password. You need to fill those in the Mail tab in your OC admin - > systems - > settings - > edit settings - > Mail tab (including your email password). At the beginning of the hostname text box:

Code: Select all

ssl://
needs to be entered in this case.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 13 guests