Order administrator notification email

  • Posts: 231
  • Thank you received: 4
  • Hikaserial Standard
7 years 9 months ago #261083

-- HikaShop version -- : 2.6.4
-- Joomla version -- : 3.6.4

Hello,
Is it possible to change when the Order administrator notification email is sent?

Currently this email is sent to the store email address when an order is created. However this is before the payment for the order has been successfully processed by either PayPal or WorldPay.

I can set it up so the customer receives the order confirmation email, only when a success payment has been processed, what I want to do is also ONLY send the administrator email when a successful payment has been completed.

The admin notification email will be used to process the order, and to negate the requirement for them to check a payment has been made (which would become too time consuming) it should only be sent on successful payment, to prevent orders being processed and shipped without payment.

How can I change the site to achieve this?

Thanks

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

  • Posts: 82866
  • Thank you received: 13373
  • MODERATOR
7 years 9 months ago #261086

Hi,

You would have to disable the email and develop a plugin implementing the onAfterOrderUpdate trigger to load the email yourself and send it yourself with quite a bit of custom code.
A way simpler method which will provide a solution quite close to what you want is to disable the order admin notification and enter your email address in the BCC field of the order status notification. That way, you will receive a copy of the email sent to the customer when the order is confirmed.

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

  • Posts: 231
  • Thank you received: 4
  • Hikaserial Standard
7 years 9 months ago #261216

Nicolas,
Thanks for the reply, I had thought of that solution also. I'll implement that method on my current site.

Perhaps in a future update of HikaShop a configuration option could be included to allow site admins to specify when the Administrator Notification email is actually sent. It still seems incorrect to send the admin email before a payment has been confirmed as this could cause an order to be processed and shipped without the customer paying for the goods?

Thanks

Lee

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

  • Posts: 82866
  • Thank you received: 13373
  • MODERATOR
7 years 9 months ago #261226

Hi,

HikaShop sends two emails to the admin, like for the customer.
It sends the order admin notification when the order is created, and the payment notification email when the payment is received.
The payment notification doesn't yet contain all the order information (although there is a link to the order details page in it) and we'll work on that in the future, but I don't see the need to add yet another email notification to the admin.
It is also important to send an email to the admin when the order is created for shops which accept offline payment methods like checks or bank transfers.

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

  • Posts: 231
  • Thank you received: 4
  • Hikaserial Standard
7 years 9 months ago #261258

Nicolas,
Thanks for the reply. I fully understand your reply, and it must be difficult trying to build a component that 'fits' everyones requirements :-)

The payment notification email would be perfect for my particular situation, if it contained all the order information as well. Is it possible to simply copy the formatting from the notification email template into the payment notification email and have it populate with the order data?

Thanks again for a great extension!

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

  • Posts: 82866
  • Thank you received: 13373
  • MODERATOR
7 years 9 months ago #261271

Hi,

No, it won't be possible. Otherwise, we would have already done it :)
It will require some proper development and testing.
That's why I suggested the BCC trick in the mean time.

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

  • Posts: 231
  • Thank you received: 4
  • Hikaserial Standard
7 years 9 months ago #261951

Currently the way Hikashop is setup is that emails are generated and automatically sent once the order is created, even if the payment is not successfully completed.

I can modify this by turning off the admin and customer order creation notification emails. I have then added the admin email as a BCC to the order status email. However this causes issues when the merchant updates an order status and informs the customer as they also receive the email (because they are cc'd into the status email). Turning off the created emails seems to prevent one being sent when a payment is made via PayPal.

What I need is for NO emails to be sent until the order is successfully paid for at either WorldPay or PayPal. Once a successful payment is made, then an email needs to be sent to the site admin and the customer. Once the order status is changed then only the customer should receive an email confirmation.

which files in the com_hikashop folder control the emails, perhaps I can work it out?

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

  • Posts: 231
  • Thank you received: 4
  • Hikaserial Standard
7 years 9 months ago #261952

As a follow, I've been digging around and found the administrator/com_hikashop/classes/order.php file.

Within this file there seems to be the email script and contains:

$dispatcher->trigger('onAfterOrderCreate', array(&$order, &$send_email));

If I were to change this, and other instances, to:

$dispatcher->trigger('onAfterOrderConfirm', array(&$order, &$send_email));

Would this then change the order notifications to be sent on order confirmation and not order creation?

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

  • Posts: 82866
  • Thank you received: 13373
  • MODERATOR
7 years 9 months ago #261955

Hi,

No. Doing that would break everything.
The simplest would be to develop a small plugin of the group "hikashop", implement the onBeforeMailSend trigger, and remove the BCC of the order_status_notification if you're in the backend.
Something like that:

$app = JFactory::getApplication();
if(!empty($mail->mail_bcc)) && $app->isAdmin()) $mailer->clearBCCs();

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

  • Posts: 231
  • Thank you received: 4
  • Hikaserial Standard
7 years 9 months ago #262125

Nicolas,
Thanks for all the help and support, it is really appreciated.

Unfortunately I'm not skilled enough in PHP to write a plugin, I may need to hire someone to complete that work.

Searching other forum posts would it be possible to include the code you mention above, or something similar, into the Preload version of the order_status_notification email?

Thanks

Lee

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

  • Posts: 82866
  • Thank you received: 13373
  • MODERATOR
7 years 9 months ago #262128

Hi,

You can try something like that in the preload:
$app = JFactory::getApplication();
if(!empty($mail->mail_bcc)) && $app->isAdmin()) $mail->mail_bcc = '';

Writting a plugin is nothing complex.
You just follow the Joomla tutorial to write one and write your function trigger in it.
We have a link to the Joomla tutorial at the beginning of our developer documentation:
www.hikashop.com/support/documentation/6...mentation.html#intro

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

Time to create page: 0.074 seconds
Powered by Kunena Forum