Skip to main content

Disabling emails

More
15 years 3 months ago #19676 by brainforge
Disabling emails was created by brainforge
Is it possible to disable the following emails from being sent to the customer:

Order creation notification
Order status notification

Please Log in or Create an account to join the conversation.

More
15 years 3 months ago #19693 by nicolas
Replied by nicolas on topic Re: Disabling emails
Yes. You can edit the emails via the menu System->Emails. There, add the line:
$data->customer->user_email = '';
at the end of the code of the email and the email won't be sent.

Please Log in or Create an account to join the conversation.

More
15 years 3 months ago #19701 by brainforge
Replied by brainforge on topic Re: Disabling emails
Seems to have done it thanks - could a (un)publish tickbox be added to your wish list to make it more obvious please?

Please Log in or Create an account to join the conversation.

More
15 years 3 months ago #19707 by nicolas
Replied by nicolas on topic Re: Disabling emails
Yes, that's a good idea.

Please Log in or Create an account to join the conversation.

More
15 years 3 months ago #20100 by brainforge
Replied by brainforge on topic Re: Disabling emails
Whoops - unexpected side affect of setting user_email = ''.

It gets inherited in other places where $user =& hikashop::loadUser(true); is called.
E.G. onAfterOrderConfirm() routines of payment plug-ins.

Will have to live with the emails for now until there is a more robust solution.

Please Log in or Create an account to join the conversation.

More
15 years 3 months ago #20101 by nicolas
Replied by nicolas on topic Re: Disabling emails
We added a publish button while doing a new build of the 1.5.2 version. If you redownload it, you should be able to unpublish the emails.

Please Log in or Create an account to join the conversation.

More
15 years 3 months ago #20104 by brainforge
Replied by brainforge on topic Re: Disabling emails
Thanks.
I was just about to download 1.5.2 and will look at it this evening, not had time until now.

Please Log in or Create an account to join the conversation.

More
15 years 3 months ago #20120 by brainforge
Replied by brainforge on topic Re: Disabling emails
Not working as expected with this afternoon's download of 1.5.2.

Looking at the code in order.php class realised that $send_email is a parameter to the onAfterOrderUpdate and onAfterOrderCreate triggers - doh!! overlooked that spending too much time concentrating on my code within the triggers and overlooked what's at the top. So that would be a place where it can be controlled with custom code.

In the order.php class I would expect to see something like this - in pseudo-code.
Code:
$send_email = true if published else false; $dispatcher->trigger( 'onAfterOrderCreate', array( & $order,&$send_email) );
Code:
$send_email = true if published else false; if ($send_email) { $send_email = @$order->history->history_notified; } $dispatcher->trigger( 'onAfterOrderUpdate', array( & $order,&$send_email) );

So the new publish/unpublish feature sets the default behaviour which custom trigger code is free to overwrite if desired.

Please Log in or Create an account to join the conversation.

More
15 years 3 months ago #20130 by nicolas
Replied by nicolas on topic Re: Disabling emails
We forgot the line:
if(isset($mail->published) && !$mail->published) return true;

after the lines:
function sendMail(&$mail){
if(empty($mail)){
return false;
}

in the file administrator/components/com_hikashop/classes/mail.php

That's why the published state didn't change anything.

Please Log in or Create an account to join the conversation.

More
15 years 3 months ago #20161 by brainforge
Replied by brainforge on topic Re: Disabling emails
Fixes it, thanks.

Please Log in or Create an account to join the conversation.

Time to create page: 0.269 seconds
Powered by Kunena Forum