Ordner Number in Mail subject

  • Posts: 61
  • Thank you received: 1
12 years 1 month ago #69210

Hi
I want add the order number into the mail subject for all mails sending to the admin of the site/shop.
How I have to do this?

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

  • Posts: 13201
  • Thank you received: 2322
12 years 1 month ago #69266

Hi Rolandus1,

I think that you will have to edit the file: "yourSite\administrator\components\com_hikashop\classes\order.php".
In the function "save()", add the line:

$mail->subject = "ORDER_STATUS_NOTIFICATION ".$order->order_number;

After:
					$send_email = @$order->history->history_notified;
					$dispatcher->trigger( 'onAfterOrderUpdate', array( & $order,&$send_email) );
					if($send_email) {
						if(empty($order->mail) && isset($order->order_status)) {
							$this->loadOrderNotification($order,'order_status_notification');
						} else {
							$order->mail->data = &$order;
							$order->mail->mail_name = 'order_status_notification';
						}
						if(!empty($order->mail)) {
							$mail = hikashop_get('class.mail');
							if(!empty($order->mail->dst_email)) {

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

  • Posts: 61
  • Thank you received: 1
12 years 1 month ago #69426

Hi I did what you described, but I got only "ORDER_STATUS_NOTIFICATION" as text in the mail subject.

In the original file I have the posted code below. Do I have to replace the line "$mail->sendMail($order->mail);" with the line you posted?


}else{
$send_email = @$order->history->history_notified;
$dispatcher->trigger( 'onAfterOrderUpdate', array( & $order,&$send_email) );
if($send_email){
if(empty($order->mail) && isset($order->order_status)){
$this->loadOrderNotification($order,'order_status_notification');
}
if(!empty($order->mail)){
$mail = hikashop_get('class.mail');
if(!empty($order->mail->dst_email)){
$mail->sendMail($order->mail);
}
$this->mail_success =& $mail->mail_success;
}
}
}
}
return $order->order_id;
}
return false;
}

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

  • Posts: 13201
  • Thank you received: 2322
12 years 1 month ago #69477

Hi,

No you have not to replace, but add before "$mail->sendMail($order->mail);".
The sendMail() function send the mail, so if you remove it...

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

  • Posts: 61
  • Thank you received: 1
12 years 1 month ago #69534

OK, now the code part looks like this, but I don't receive any order number in the "new order" mail to the administrator.



}else{
$send_email = @$order->history->history_notified;
$dispatcher->trigger( 'onAfterOrderUpdate', array( & $order,&$send_email) );
if($send_email){
if(empty($order->mail) && isset($order->order_status)){
$this->loadOrderNotification($order,'order_status_notification');
}
if(!empty($order->mail)){
$mail = hikashop_get('class.mail');
if(!empty($order->mail->dst_email)){
$mail->subject = "ORDER_STATUS_NOTIFICATION".$order->order_number;
$mail->sendMail($order->mail);
}
$this->mail_success =& $mail->mail_success;
}
}
}
}
return $order->order_id;
}
return false;

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

  • Posts: 13201
  • Thank you received: 2322
12 years 1 month ago #69600

My apologize the wrong code has been edited, you edited to have the order number for a status update.
To have the order number in the order creation mail, in the same file replace:

							$order->mail->subject = trim($order->mail->subject);
							if(empty($order->mail->subject)) {
								$order->mail->subject = JText::sprintf('NEW_ORDER_SUBJECT',$order->order_number,HIKASHOP_LIVE);
							}

By:
							$order->mail->subject = '';
							if(empty($order->mail->subject)) {
								$order->mail->subject = JText::sprintf('NEW_ORDER_SUBJECT',$order->order_number,HIKASHOP_LIVE);
							}

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

  • Posts: 61
  • Thank you received: 1
12 years 1 month ago #69628

It works !
But I wanted first the order number in the subject, then the subject text, because I want order the e-mail list by order number.
What I get now as admin is a subject only with the order number without the following text.
What's wrong ?


$order->mail->subject = '';
if(empty($order->mail->subject)) {
$order->mail->subject = JText::sprintf($order->order_number,'NEW_ORDER_SUBJECT',HIKASHOP_LIVE);
}

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

  • Posts: 13201
  • Thank you received: 2322
12 years 1 month ago #69635

You can make your own text for this email, you just have to replace the content of the "$order->mail->subject" variable.
For example:

$order->mail->subject = $order->order_number." - New Order on your website: ".HIKASHOP_LIVE;
(HIKASHOP_LIVE is the url of your website)

The following user(s) said Thank You: Rolandus1

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

  • Posts: 61
  • Thank you received: 1
12 years 1 month ago #69676

Perfekt. Thank you !

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

Time to create page: 0.067 seconds
Powered by Kunena Forum