Custom Subject in Confirmation email

  • Posts: 79
  • Thank you received: 2
8 years 11 months ago #224300

-- HikaShop version -- : 2.6.0
-- Joomla version -- : 3.4.6
-- PHP version -- : 5.4.38

Hi,
I set up the confirmation email so that only some information show when the order_status is "confirmed" and when the order_status is "shipped".
Now what i would like to do is depending on the order_status change the subject line.
I have looked in the language file, but the status is %s.
So what i tried to do in the pre-load of the confirmation email is the following:

if($data->order_status=='confirmed') {
	$data->$mail->subject = 'Custom text for order confirmation;
} elseif($data->order_status=='shipped') {
	 $data->$mail->subject = 'Custom text for shipped order';
 }

Now i found the code $data->$mail->subject = 'Custom text for order confirmation; in one of the thread, but i can seem to make it work with the if statement.
Any help would be appreciated.
Thanks

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
8 years 11 months ago #224335

It should be $data->mail->subject and not $data->$mail->subject

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

  • Posts: 79
  • Thank you received: 2
8 years 11 months ago #224529

I tried it like you said. It didnt work. It still pulls the text from the language file (ORDER_STATUS_NOTIFICATION_SUBJECT)

I just did the line $data->mail->subject = 'Custom text for order confirmation;
without the if statement, but that doesnt matter either. Also first i had it at the bottom in the preload, then moved it to the top. But that doesnt matter either.

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

  • Posts: 79
  • Thank you received: 2
8 years 10 months ago #225570

I resolved the issue.

The following user(s) said Thank You: Jerome

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

  • Posts: 28
  • Thank you received: 0
7 years 6 months ago #270040

@rkuiper could you show how you were able to resolve this? I am too trying to have a custom subject in the order emails, in my scenario I'm checking against the payment method used. I also have not been able to get the subject to display other the the default "ORDER_CREATION_NOTIFICATION_SUBJECT"

I'm running Hikashop version 3.0 Business edition.

Any help on this would be great! Thanks!

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

  • Posts: 79
  • Thank you received: 2
7 years 6 months ago #270072

The way i solved it is with the following code:

<?php
if($data->order_status=='confirmed') 
	{$mail->subject = 'Custom Subject #1';} 
elseif($data->order_status=='processing') 
	{$mail->subject = 'Custom Subject #2';}
elseif($data->order_status=='packing') 
	{$mail->subject = 'Custom Subject #3';}
 ?>

This code i put into the HTML at the top of the ORDER_STATUS_NOTIFICATION_SUBJECT.

Im not for sure what you want is going to work. At least not into the "ORDER_CREATION_NOTIFICATION_SUBJECT" since that email is send out before payment is done. i would assume if you want it based on a certain payment method, that you have to get the field for the payment instead of the $data->order_status.

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

Time to create page: 0.075 seconds
Powered by Kunena Forum