Post by smith_ka » Sun Apr 19, 2020 3:01 am

OCV3.0.3.2/ Journal3

Emails for product returns are not working as expected - When attempting to communicate the status of sales returns to the customer I track it through the "return history". However when I check the "notify customer" box, the Email fails to send.

Is there a workaround for this? I would very much like to use this OC feature.

TIA :)

New member

Posts

Joined
Mon Mar 30, 2020 12:24 am

Post by straightlight » Sun Apr 19, 2020 3:31 am

Are all your events active from your OC admin - > extensions - > events page?
Is your email form properly set-up in your OC admin - > systems - > settings - > add / edit setitngs - > Mail tab?

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 smith_ka » Sun Apr 19, 2020 4:14 am

Hi Straightlight,

All events are enabled on the events page and my email is set-up correctly in OC admin (it works perfectly when I check the similar "notify customer" for order-status). I think this is a known glitch... just wondering if anyone knew of a workaround for V3.0.3.2?

New member

Posts

Joined
Mon Mar 30, 2020 12:24 am

Post by straightlight » Sun Apr 19, 2020 4:22 am

I did reported model / event issues, still on OC v3.0.3.2, to Daniel last month regarding the returns. Unfortunately, there are still bugs in there but I don't know yet if they've been fixed on the master branch. There has been a solution posted on the OC v2.x section of the forum before but I may not know either if these posts are also suitable for OC v3.x releases at this time ...

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 smith_ka » Sun Apr 19, 2020 5:31 am

OK thanks, I'll keep my eyes peeled in case anything pops up and also see if I can use any of the older version fixes. At least I can tweak the "order history" email notifications to use for returns in the interim. It just seems a shame to have such a useful functionality and not be able to use it ???

New member

Posts

Joined
Mon Mar 30, 2020 12:24 am

Post by straightlight » Sun Apr 19, 2020 5:37 am

smith_ka wrote:
Sun Apr 19, 2020 5:31 am
OK thanks, I'll keep my eyes peeled in case anything pops up and also see if I can use any of the older version fixes. At least I can tweak the "order history" email notifications to use for returns in the interim. It just seems a shame to have such a useful functionality and not be able to use it ???
Unfortunately, I would have to agree on that one - at least based on the core's perspective - especially due to the COVID-19 situation. Many customers may want to find a way to return their products from the store which, sadly, there are still some bugs needed to be fixed. I do, however, encourage to keep an opened door to your contact us page in case major incidents are reported to you regarding the returned products until the issue being resolved.

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 letxobnav » Sun Apr 19, 2020 8:14 am

event trigger admin/model/sale/return/addReturn/after
should be admin/model/sale/return/addReturnHistory/after

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by straightlight » Sun Apr 19, 2020 8:23 am

Yes, that is one of them but there's more when submitting the return form from the catalog-end side. The model or controller keys needs to be fixed.

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 caglayanadiguzel » Wed Jan 27, 2021 2:39 am

Hi everyone! Is this bug fixed somehow?


Posts

Joined
Fri May 01, 2020 8:25 pm

Post by straightlight » Wed Jan 27, 2021 3:47 am

caglayanadiguzel wrote:
Wed Jan 27, 2021 2:39 am
Hi everyone! Is this bug fixed somehow?
Vague. More info.

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 caglayanadiguzel » Tue Feb 16, 2021 7:00 am

straightlight wrote:
Wed Jan 27, 2021 3:47 am
caglayanadiguzel wrote:
Wed Jan 27, 2021 2:39 am
Hi everyone! Is this bug fixed somehow?
Vague. More info.
Hi,

I am using Opencart 3.0.3.6 and all my events(47) on extensions page are in enabled format. But still there is no email is being triggered during return activity. How can I make it active so I and customer may receive email every time there is a return activity?

Here is the link for all events that are enabled in my system: https://ibb.co/YkpXB8x

Best Regards,
Caglayan


Posts

Joined
Fri May 01, 2020 8:25 pm

Post by sw!tch » Tue Feb 16, 2021 8:44 am

You have to fix the event.

So in phpmyadmin go to oc_event and find the event code called admin_mail_return then change the trigger from

Code: Select all

admin/model/sale/return/addReturn/after
to

Code: Select all

admin/model/sale/return/addReturnHistory/after
https://github.com/condor2/opencart/com ... d80309b232
https://github.com/opencart/opencart/issues/6074

Full Stack Web Developer :: Send a PM for Custom Work.
Backup and learn how to recover before you make any changes!


Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm

Post by caglayanadiguzel » Tue Feb 16, 2021 10:42 am

sw!tch wrote:
Tue Feb 16, 2021 8:44 am
You have to fix the event.

So in phpmyadmin go to oc_event and find the event code called admin_mail_return then change the trigger from

Code: Select all

admin/model/sale/return/addReturn/after
to

Code: Select all

admin/model/sale/return/addReturnHistory/after
https://github.com/condor2/opencart/com ... d80309b232
https://github.com/opencart/opencart/issues/6074
Hi,

So far I have done this and did a test. I have returned a product from dummy customer and also added history to that return request in admin consol by notifying customer as well. No email has been sent so far. Do you know why it is not being triggered any email at all?

SS:https://ibb.co/brMnBC8

Best Regards,
Caglayan


Posts

Joined
Fri May 01, 2020 8:25 pm

Post by sw!tch » Tue Feb 16, 2021 11:00 am

caglayanadiguzel wrote:
Tue Feb 16, 2021 10:42 am
Do you know why it is not being triggered any email at all?
Check your error logs (PHP error log and Opencart error log).

Full Stack Web Developer :: Send a PM for Custom Work.
Backup and learn how to recover before you make any changes!


Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm

Post by caglayanadiguzel » Tue Feb 16, 2021 11:18 am

sw!tch wrote:
Tue Feb 16, 2021 11:00 am
caglayanadiguzel wrote:
Tue Feb 16, 2021 10:42 am
Do you know why it is not being triggered any email at all?
Check your error logs (PHP error log and Opencart error log).
I have checked both and there is nothing regarding with that I assume. What I expect is that when there is a return request, as an admin I should receive an email. Does this meant to happen? Below is the ss from both php error log as well as open cart error log.

SS: https://ibb.co/PNqSrjM


Posts

Joined
Fri May 01, 2020 8:25 pm

Post by sw!tch » Tue Feb 16, 2021 11:32 am

caglayanadiguzel wrote:
Tue Feb 16, 2021 11:18 am
What I expect is that when there is a return request, as an admin I should receive an email. Does this meant to happen?
The return history notification only goes to the customer by default. You can however modify the event a bit if you wanted to send a copy to the admin as well.

Full Stack Web Developer :: Send a PM for Custom Work.
Backup and learn how to recover before you make any changes!


Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm

Post by caglayanadiguzel » Tue Feb 16, 2021 11:54 am

Any help on how to modify it to get it also sent for admin would be appreciated :)

Code: Select all

<?php
class ControllerMailReturn extends Controller {
	public function index($route, $args, $output) {
		if (isset($args[0])) {
			$return_id = $args[0];
		} else {
			$return_id = '';
		}
		
		if (isset($args[1])) {
			$return_status_id = $args[1];
		} else {
			$return_status_id = '';
		}		
		
		if (isset($args[2])) {
			$comment = $args[2];
		} else {
			$comment = '';
		}
		
		if (isset($args[3])) {
			$notify = $args[3];
		} else {
			$notify = '';
		}		
		
		if ($notify) {
			$this->load->model('sale/return');
			
			$return_info = $this->model_sale_return->getReturn($return_id);
			
			if ($return_info) {
				$this->load->language('mail/return');

				$data['return_id'] = $return_id;
				$data['date_added'] = date($this->language->get('date_format_short'), strtotime($return_info['date_modified']));
				$data['return_status'] = $return_info['return_status'];
				$data['comment'] = strip_tags(html_entity_decode($comment, ENT_QUOTES, 'UTF-8'));

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

				$mail->setTo($return_info['email']);
				$mail->setFrom($this->config->get('config_email'));
				$mail->setSender(html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'));
				$mail->setSubject(sprintf($this->language->get('text_subject'), html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'), $return_id));
				$mail->setText($this->load->view('mail/return', $data));
				$mail->send();
			}
		}
	}
}	


Posts

Joined
Fri May 01, 2020 8:25 pm

Post by sw!tch » Tue Feb 16, 2021 12:17 pm

caglayanadiguzel wrote:
Tue Feb 16, 2021 11:54 am
Any help on how to modify it to get it also sent for admin would be appreciated :)
admin/controller/mail/return.php

After

Code: Select all

$mail->send();  
Add

Code: Select all

$mail->setTo($this->config->get('config_email'));
$mail->send();  
You can create an ocmod if needed.

https://github.com/opencart/opencart/wi ... ion-System
-

Full Stack Web Developer :: Send a PM for Custom Work.
Backup and learn how to recover before you make any changes!


Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm

Post by xxvirusxx » Tue Feb 16, 2021 3:04 pm

I don't know why return wasn't completed.
Return controller from admin is only to send email to customers when site admin edit a Return and update a status. As per message is the customer message

Code: Select all

// Text
$_['text_subject']       = '%s - Return Update %s';
$_['text_return_id']     = 'Return ID:';
$_['text_date_added']    = 'Return Date:';
$_['text_return_status'] = 'Your return has been updated to the following status:';
$_['text_comment']       = 'The comments for your return are:';
$_['text_footer']        = 'Please reply to this email if you have any questions.';
https://github.com/opencart/opencart/issues/9353

And based on @sw!tch modification you will never receive email as admin...when a customer make a return.
Because of notify function you will receive email as admin, only when check notify option...but is too late, because return is registered in database already. So you need to keep an eye on Returns from admin.

A catalog controller should be created....for admin notification.

Attachments

return.png

return.png (23.28 KiB) Viewed 3241 times


Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by sw!tch » Tue Feb 16, 2021 3:51 pm

xxvirusxx wrote:
Tue Feb 16, 2021 3:04 pm
And based on @sw!tch modification you will never receive email as admin...when a customer make a return.
Because of notify function you will receive email as admin, only when check notify option...but is too late, because return is registered in database already.
Right, There is no mail sent from the frontend when a customer initiates a return by default.

The above is only for the backend return history. If you want a party to be notified you need to have notify checked.

If you want a simple "admin return alert notice" sent from the frontend when a custom fills out a return, then an event can be made to handle that in few lines of code.

Full Stack Web Developer :: Send a PM for Custom Work.
Backup and learn how to recover before you make any changes!


Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm
Who is online

Users browsing this forum: No registered users and 97 guests