-- HikaShop version -- : 4.4.4
-- Joomla version -- : 3.10.2
Since I upgraded to Hikashop 4.4.4 no more payment notification mails are sent to the administrator.
I traced the problem down to the following code in helpers/paymentplugin.php:
if(!empty($id)) {
$dbOrder = $orderClass->get($id);
$message = str_replace('<br/>', "\r\n", JText::sprintf('PAYMENT_NOTIFICATION_STATUS', $this->name, $payment_status)) . ' ' .
JText::sprintf('ORDER_STATUS_CHANGED', $mail_status) .
"\r\n".JText::sprintf('NOTIFICATION_OF_ORDER_ON_WEBSITE', $dbOrder->order_number, HIKASHOP_LIVE);
$orderMail = $orderClass->loadNotification((int)$id, 'payment_notification', $message);
if(empty($orderMail->mail->subject))
$orderMail->mail->subject = JText::sprintf('PAYMENT_NOTIFICATION_FOR_ORDER', $this->name, $payment_status, $dbOrder->order_number);
if(HIKASHOP_J30) {
$mailClass->mailer->addReplyTo($orderMail->mail->dst_email, $orderMail->mail->dst_name);
} else {
$mailClass->mailer->addReplyTo(array($orderMail->mail->dst_email, $orderMail->mail->dst_name));
}
$orderMail->mail->dst_email = $recipients;
$orderMail->mail->dst_name = '';
$mailClass = hikashop_get('class.mail');
$mailClass->sendMail($orderMail->mail);
return;
}
Line 335 triggers a HTTP 500 Internal error.
I am wondering if this might be because initialization of $mailClass is not yet done at this moment. When moving the following line up, the error disappears and mails are sent again:
$mailClass = hikashop_get('class.mail');
Full code with the modification:
if(!empty($id)) {
$dbOrder = $orderClass->get($id);
$message = str_replace('<br/>', "\r\n", JText::sprintf('PAYMENT_NOTIFICATION_STATUS', $this->name, $payment_status)) . ' ' .
JText::sprintf('ORDER_STATUS_CHANGED', $mail_status) .
"\r\n".JText::sprintf('NOTIFICATION_OF_ORDER_ON_WEBSITE', $dbOrder->order_number, HIKASHOP_LIVE);
$orderMail = $orderClass->loadNotification((int)$id, 'payment_notification', $message);
if(empty($orderMail->mail->subject))
$orderMail->mail->subject = JText::sprintf('PAYMENT_NOTIFICATION_FOR_ORDER', $this->name, $payment_status, $dbOrder->order_number);
$mailClass = hikashop_get('class.mail');
if(HIKASHOP_J30) {
$mailClass->mailer->addReplyTo($orderMail->mail->dst_email, $orderMail->mail->dst_name);
} else {
$mailClass->mailer->addReplyTo(array($orderMail->mail->dst_email, $orderMail->mail->dst_name));
}
$orderMail->mail->dst_email = $recipients;
$orderMail->mail->dst_name = '';
$mailClass->sendMail($orderMail->mail);
return;
}
Could you please check this. Thank you very much.
Best regards