Admin is receiving order creation email but not getting payment confirm mail

  • Posts: 79
  • Thank you received: 0
6 years 7 months ago #291526

-- HikaShop version -- : business 3.0.0
-- Joomla version -- : 3.6.4

Hi, our ecommerce shop is user can receiving both order created and order confirmation email, but admin can only receive order creation email, order confirmation email unable to receive. please advice which part is affecting this part? we did not touch anything on email configure and order status.

Attachments:

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
6 years 7 months ago #291527

Hi,

Normally, the payment plugin is supposed to send a payment notification email when it receives the payment notification from the payment gateway and confirms the order.
So that's why HikaShop doesn't send itself an order confirmation email to the owner.
If you don't get the payment notification email, make sure that you have your email address in the "payment notification email address" setting of the HikaShop configuration. Also, it could be your payment plugin not supporting that if it's made by a 3rd party developer.
Alternatively, you can add your email address in the CC field of the order status notification so that you can receive a copy of the order confirmation email that the customer receives.

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

  • Posts: 79
  • Thank you received: 0
6 years 7 months ago #291566

Hi there. Thanks for the reply.

The weird thing is, the payment plugin that we developed acknowledges the payment signal and update the status of the order from pending to confirmed inside the database. Its just the hikashop email on the status notification change is not received.

The payment notification email address is filled in. the same value as the Order creation email field value. Thats why we find it weird why the order created email is received but not the payment notification one.

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
6 years 7 months ago #291574

Hi,

Again, HikaShop doesn't send any email to the administrator when the order status is changed by a payment plugin.
It's up to the payment plugin to send the email itself.
That's because the payment plugin can change the order status to different statuses based on what happened with the transaction and oftne wants to add specific information about the issues encountered with the transaction. So It's not HikaShop sending the email but the payment plugin.
The example payment plugin we provide doesn't include the email sending in order to make it easier to understand the payment plugin development. But if you look at any payment plugin included in HikaShop, you'll see the code to send the email to the administrator. The paypal plugin is a good example.

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

  • Posts: 79
  • Thank you received: 0
6 years 7 months ago #291651

Hi, Thanks for the explanation

Seems like we missed this function, can please share with us how this should be done or do you have a guideline or documentation for this part?

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
6 years 7 months ago #291671

Hi,

In the paypal plugin you have that code which sets the subject and the body of the email and add it in the modifyOrder function call so that it will be sent for you:

$email = new stdClass();
		$email->subject = JText::sprintf('PAYMENT_NOTIFICATION_FOR_ORDER','Paypal',$vars['payment_status'],$dbOrder->order_number);
		$email->body = str_replace('<br/>',"\r\n",JText::sprintf('PAYMENT_NOTIFICATION_STATUS','Paypal',$vars['payment_status'])).' '.JText::sprintf('ORDER_STATUS_CHANGED',hikashop_orderStatus($order_status))."\r\n\r\n".$order_text;

		$this->modifyOrder($order_id, $order_status, $history, $email);
But you can also send an email manually using Joomla:
docs.joomla.org/Sending_email_from_extensions

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

  • Posts: 5
  • Thank you received: 0
6 years 6 months ago #293059

I got that function in modifyOrder my iPay88 plugin but its triggering 2 times.

So can you share how can i trigger "Order administrator notification" email template of hikashop ?

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
6 years 6 months ago #293070

Hi,

The "order administrator notification" is sent when the order is created, not when the order status is changed.

If you want to send it within some code on your end, you can add such code:

$orderClass = hikashop_get('class.order');
$mail = $orderClass->loadNotification((int)$order_id, 'order_admin_notification');
$mailClass = hikashop_get('class.mail');
$mailClass->sendMail($mail);

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

  • Posts: 5
  • Thank you received: 0
6 years 6 months ago #293104

So the thing is should i need to put that bellow code inside onPaymentNotification function so code will be like:

function onPaymentNotification(&$statuses)
{
.......
.......
.......
$orderClass = hikashop_get('class.order');
$mail = $orderClass->loadNotification((int)$order_id, 'order_admin_notification');
$mailClass = hikashop_get('class.mail');
$mailClass->sendMail($mail);
$this->modifyOrder($order_id, $order_status, $history, false);
}


and that will gives payment confirm mail ?

Thanks

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

  • Posts: 12953
  • Thank you received: 1778
6 years 6 months ago #293108

Hello,

You'll have to add it through your payment plugin code where the payment method will confirm your order.

Note that creating a custom plugin and using that trigger will probably also do the job : onAfterOrderConfirm(&$order,&$methods,$method_id)

For more information about Hikashop triggers :
www.hikashop.com/support/documentation/6...#onAfterOrderConfirm

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

  • Posts: 5
  • Thank you received: 0
6 years 6 months ago #293174

Thanks,

I have patch code given by you but that's not work

I did not not getting payment confirm mail. Please check given code bellow which i have place in , I have used Ipay88 payment plugin

as well as i have tried it on : onPaymentNotification within Ipay88 payment plugin

function onAfterOrderConfirm(&$order, &$methods, $method_id) 
{
		parent::onAfterOrderConfirm($order, $methods, $method_id);
	        ....
                ....
                ....
                $orderClass = hikashop_get('class.order');
                $mail = $orderClass->loadNotification((int)$order_id, 'order_admin_notification');
                $mailClass = hikashop_get('class.mail');
                $mailClass->sendMail($mail);
                $this->modifyOrder($order_id, $order_status, $history, false);
                
                $vars['Amount'] = number_format((float)$vars['Amount'], 2, '.', '');
		$vars['Signature'] = $this->_getIPay88_signature($this->payment_params->merchant_key.$vars['MerchantCode'].$vars['RefNo'].str_replace('.','',$vars['Amount']).$vars['Currency']);
	
		$query_url 		= 'https://www.mobile88.com/epayment/entry.asp';
		$this->payment_params->url = $query_url; 
                $this->vars = $vars;
		return $this->showPage('end');
	}

Last edit: 6 years 6 months ago by John_D.

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
6 years 6 months ago #293177

Hi,

Please note that you need to define the different variables $order_id, $order_status, $history before that code, otherwise, it can't work.

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

  • Posts: 5
  • Thank you received: 0
6 years 5 months ago #293262

So my edited code is now given bellow:

Please have look and let me know that will work OR can you give me reference how can i get variables $order_id, $order_status, $history before that code.


function onAfterOrderConfirm(&$order, &$methods, $method_id)
{
........
.........
.........
// Edited
$order_id = $order->order_id;
$order_status = $order->order_status;

$config =& hikashop_config();
if($config->get('order_confirmed_status','confirmed') == $order_status){
$history->notified = 1;
}

$orderClass = hikashop_get('class.order');
$mail = $orderClass->loadNotification((int)$order_id, 'order_admin_notification');
$mailClass = hikashop_get('class.mail');
$mailClass->sendMail($mail);
// Edited
........
.........
.........
}

OR Can you give code sample please to make this work for to get payment confirm email to admin please ?

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
6 years 5 months ago #293266

Hi,

If you want to send the order confirmation email to the admin, then you should add the email address of the admin in the "BCC" field of the order status notification.
It would be way simpler...

Regarding your code, it should send the "order admin notification" to the admin when the order is created.
If you want it to be sent when the order is confirmed, you should add it to the onPaymentNotification function of your plugin.
However, this also requires that the orders are being confirmed automatically by your payment plugin and it won't work if you manually change the order status in the backend.
Also, that code, while I think it should work, has not been tested. so it might require some debugging to check that $mail contains the correct data, etc. And it's possible that it wouldn't work based on how you configured your HikaShop. For example, if you've unpublished the order admin notification, the sendMail function won't send that email.

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

  • Posts: 5
  • Thank you received: 0
6 years 5 months ago #293650

Hi,

As i have placed the code in both function onAfterOrderConfirm and onPaymentNotification to debug it but it is not working.

So can you let me know the possible way to debug it ? because i have used Ipay88 plugin and every time i need to Pay when i made real payment ?

Can you please give updated code which send "order admin notification" trigger and one thing i need to ask is how can i debug it without made real Payment ?

As i have checked in pay pal plugin too but its not working. So can you please share updated function that trigger "payment confirm mail " to get payment confirm mail to admin ?

Last edit: 6 years 5 months ago by John_D.

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

  • Posts: 12953
  • Thank you received: 1778
6 years 5 months ago #293673

Hello,

how can i debug it without made real Payment ?


You can either call the notification URL with parameters attached from your last payment, or use the sandbox mode of your payment plugin (payment platforms generally have sandbox mode).

Also, using that kind of code will probably do the job :
$orderClass = hikashop_get('class.order');
$mail = $orderClass->loadNotification((int)$order_id, 'order_admin_notification');
$mail->bcc_email = 'YOUR_ADMIN_EMAIL';
$mailClass = hikashop_get('class.mail');
$mailClass->sendMail($mail);

You'll just have to replace the "YOUR_ADMIN_EMAIL" by the email address where you want you email to be sent.

Best regards,
Mohamed Thelji.

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

Time to create page: 0.096 seconds
Powered by Kunena Forum