Disabling emails

  • Posts: 292
  • Thank you received: 5
  • Hikashop Business
13 years 5 months ago #19676

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.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
13 years 5 months ago #19693

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.

  • Posts: 292
  • Thank you received: 5
  • Hikashop Business
13 years 5 months ago #19701

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.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
13 years 5 months ago #19707

Yes, that's a good idea.

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

  • Posts: 292
  • Thank you received: 5
  • Hikashop Business
13 years 4 months ago #20100

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.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
13 years 4 months ago #20101

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.

  • Posts: 292
  • Thank you received: 5
  • Hikashop Business
13 years 4 months ago #20104

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.

  • Posts: 292
  • Thank you received: 5
  • Hikashop Business
13 years 4 months ago #20120

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.

$send_email = true if published else false;
$dispatcher->trigger( 'onAfterOrderCreate', array( & $order,&$send_email) );
$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.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
13 years 4 months ago #20130

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.

  • Posts: 292
  • Thank you received: 5
  • Hikashop Business
13 years 4 months ago #20161

Fixes it, thanks.

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

Time to create page: 0.074 seconds
Powered by Kunena Forum