Payment notification no more sent in paymentplugin.php

  • Posts: 15
  • Thank you received: 6
  • Hikashop Business
2 years 6 months ago #336376

-- 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

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

  • Posts: 81508
  • Thank you received: 13064
  • MODERATOR
2 years 6 months ago #336377

Hi,

Yes, this was fixed on our end last week as a hot patch.
If you download again the install package of HikaShop on our website and install it on yours, you'll get the patch automatically.

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

Time to create page: 0.055 seconds
Powered by Kunena Forum