Show username in subject admin notification email

  • Posts: 45
  • Thank you received: 0
8 years 5 months ago #222396

-- HikaShop version -- : 2.6.0. Business

Hi,

I want to show the customer name in the subject of the admin notification email. Is this possible? And how?

Thanks!

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

  • Posts: 81597
  • Thank you received: 13081
  • MODERATOR
8 years 5 months ago #222499

Hi,

There is no option to do that.
You would have to modify the preload code of the email via the menu System>Emails in order to do that.
There, you could add such code:

<?php $data->mail->subject = 'new order for user '.$order->customer->username; ?>

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

  • Posts: 45
  • Thank you received: 0
8 years 4 months ago #223858

Hi Nicolas,

I tried your code in the preload code. I added it at the end, but it did not have any effect. I removed the original subjectline (ORDER_ADMIN_NOTIFICATION_SUBJECT).

Does the position matter?

Thanks!

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

  • Posts: 81597
  • Thank you received: 13081
  • MODERATOR
8 years 4 months ago #223898

Hi,

I would rather recommend to add it at the beginning of the preload.

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

  • Posts: 45
  • Thank you received: 0
8 years 4 months ago #224097

Hi Nicolas,

I tried that also, but it didn't work. I removed the original subject line, but in the email the subject now is something like:

New order nr. xxxx generated on www.example.com (translated).

Do you have any other suggestions?

Thanks again.

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

  • Posts: 81597
  • Thank you received: 13081
  • MODERATOR
8 years 4 months ago #224115

Hi,

My bad, I made a mistake.
Try like this instead:
<?php $data->mail->subject = 'new order for user '.$data->customer->username; ?>

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

  • Posts: 45
  • Thank you received: 0
8 years 4 months ago #224214

Hi Nicolas,

No, this doesn't work either. Nothing happens. Below is the start of my preload code:

/**
 * @package	HikaShop for Joomla!
 * @version	2.6.0
 * @author	hikashop.com
 * @copyright	(C) 2010-2015 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?>

<?php
$data->mail->subject = 'new order for user '.$data->customer->username;

$app = JFactory::getApplication();
$config = hikashop_config();
$orderClass = hikashop_get('class.order');
$imageHelper = hikashop_get('helper.image');
$productClass = hikashop_get('class.product');
$fieldsClass = hikashop_get('class.field');
if(hikashop_level(2)) {
	$null = null;
	$itemFields = $fieldsClass->getFields('frontcomp',$null,'item');
}

Any other ideas?

Thanks!

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

  • Posts: 12953
  • Thank you received: 1778
8 years 3 months ago #225641

Hello,
Sorry for the late reply, If you still have that issue, can you try it with that code :

<?php $mail->subject = 'new order for user '.$data->customer->username; ?>

The following user(s) said Thank You: pepecortez, Squashtoppertje

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

  • Posts: 45
  • Thank you received: 0
8 years 3 months ago #226567

Hi Mohamed,

This is the solution. Great, thanks!

Have a nice weekend!

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

Time to create page: 0.084 seconds
Powered by Kunena Forum