[SOLVED] Add ORDER NUMBER to the Subject Line

  • Posts: 284
  • Thank you received: 6
11 years 6 months ago #71814

We use Google Business email for our domain emails.
While it is good, the whole concept of conversation and email THREADS is based on the SUBJECT LINE of the email.

HikaShop sends the email "A new order has been created on your website" but there isn't any ORDER NUMBER in that subject line.
SO -- Gmail threads ALL of our orders together in one huge thread.
It makes it very difficult to look at the latest order received, have a conversation with the purchaser, etc.

Would it be possible to add the ORDER NUMBER to the Subject Line of that first 'A new order...' email?
The order number appears in the Payment Received emails subject line...

Thanks!

Last edit: 11 years 6 months ago by MSTACE.

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

  • Posts: 2334
  • Thank you received: 403
11 years 6 months ago #71838

Hi,

As it's explained in this topic , you have to replace the following lines in administrator/component/com_hikashop/class/order.php

$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 these lines:
$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: 284
  • Thank you received: 6
11 years 6 months ago #71990

There is a quotation mark missing from that code example.
I used the other code explained in that topic and it works terrific!

Might suggest that this become an option in the configuration as it is quite helpful.

Thank you.

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

  • Posts: 234
  • Thank you received: 4
11 years 2 months ago #91898

Which file would I put this in so that the customer also has the order number in their subject? Also is there a way to have the orders come to us with the customers e-mail address as the FROM instead of having our own e-mail address as the FROM information.

Thanks
Iain

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

  • Posts: 13201
  • Thank you received: 2322
11 years 2 months ago #91931

For the customers, you have to edit the mails "Order creation notification" and "Order status notification".
To change the sender email you can use the code:
<?php $mails->sender = $data->cart->customer->email; ?>
At the end of the mail.

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

  • Posts: 13201
  • Thank you received: 2322
11 years 2 months ago #91932

For the customers, you have to edit the mails "Order creation notification" and "Order status notification".
To change the sender email you can use the code:
<?php $mail->sender = $data->cart->customer->email; ?>
At the end of the mail.

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

  • Posts: 234
  • Thank you received: 4
11 years 2 months ago #91981

Hello,

I have put that at the end of the email and it doesn't change. When you say at the end, do you mean the very last line?

Iain

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

  • Posts: 13201
  • Thank you received: 2322
11 years 2 months ago #92022

Can you try with "$this->mailer->Sender" instead of "$mail->sender" ?

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

  • Posts: 234
  • Thank you received: 4
11 years 2 months ago #92034

That is the same, no change. I am putting this at the bottom of System>email>Order administrator notification.

Yours
Iain

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

  • Posts: 81597
  • Thank you received: 13081
  • MODERATOR
11 years 2 months ago #92389

There is no need to do that change.

The From is indeed not the user email but the Reply-To is. Which means that if you click on reply on the order admin email, you will send the reply to the user email address automatically.

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

  • Posts: 234
  • Thank you received: 4
11 years 2 months ago #92413

Nicolas

Thank you but I find it annoying when looking down a list of e-mails not to see the customers name but only Draganfly Motorcycles.

Iain

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

  • Posts: 81597
  • Thank you received: 13081
  • MODERATOR
11 years 2 months ago #92430

In that case add such code at the end of the order admin email:

<?php
$userClass = hikashop_get('class.user');
$userClass->get(false);
$user = $userClass->get($data->order_user_id);
$mail->from_email = $user->user_email;
$mail->from_name = $user->name;

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

  • Posts: 194
  • Thank you received: 5
9 years 8 months ago #166743

Needing to revive this old thread ....

I'm using HS Business 2.3.2.

I've made the change to the /administrator/components/com_hikashop/classes/order.php file as indicated here in this thread.

Here is the code that I inserted:

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

However, when the emails are sent, the subject line is being sent like this:

New order No. 03390 created on HIKASHOP_LIVE


I have added 'HIKASHOP_LIVE' to the lanugage overrides area of Joomla, but it isn't being 'translated' (although 'NEW_ORDER_SUBJECT' IS).

Any ideas why this isn't working?

Last edit: 9 years 8 months ago by cpaschen. Reason: fixing code indenting

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

  • Posts: 194
  • Thank you received: 5
9 years 8 months ago #166744

OK... I've narrowed it down.

The current language string for NEW_ORDER_SUBJECT is "New order N0. %s created on %s"

I've removed the quotes around 'HIKASHOP_LIVE'.

(I saw a mention of quote missing earlier in this thread and though that 'hikashop_live' was a language string to be handled by JText) Hopefully this will help.

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

  • Posts: 194
  • Thank you received: 5
9 years 8 months ago #166762

OK ... it was the quotes on that 2nd entry.

So the working version of the code should be:

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


However, that HIKASHOP_LIVE variable inserts the URL to the site.

Anybody know if there is a way (a different variable) to insert the 'Name' of the site (instead of the URL)?

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

  • Posts: 26017
  • Thank you received: 4004
  • MODERATOR
9 years 8 months ago #166777

Hi,

HIKASHOP_LIVE is the url to the live site ; if you want to display something else you should put something else in the code.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 194
  • Thank you received: 5
9 years 8 months ago #166808

Jerome,

Thanks, but that doesn't answer my question - WHAT variable can I use for the 'name' of the site?

Or better yet, is there a doc somewhere that lists any variables that are specific to Hikashop that could be used here (or other places of HS/Joomla)?

I'm guessing that I could just use standard Joomla variables/resources here, but I could have done that instead of 'HIKASHOP_LIVE'.

So what other variables like this (specific to HS) are also available?

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

  • Posts: 81597
  • Thank you received: 13081
  • MODERATOR
9 years 8 months ago #166821

Hi,

HikaShop does not have any variable for the website name, only for the website URL.
If you want to get the website name, that's a setting of the Joomla configuration, so you can access it with Joomla code:
$conf = JFactory::getConfig();
echo $conf->get('sitename');

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

  • Posts: 80
  • Thank you received: 0
9 years 4 months ago #183195

Id really like to request an easier way to do this as a feature, such as field in CONFIG that lets you enter macros and text.

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

  • Posts: 284
  • Thank you received: 6
9 years 4 months ago #183211

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

Time to create page: 0.138 seconds
Powered by Kunena Forum