[SOLVED] Custom email notification of orders

  • Posts: 26
  • Thank you received: 0
11 years 4 weeks ago #130331

-HikaShop version: HikaShop Business 2.2.2
-Joomla version: Joomla! 3.1.5

I have modified the admin, and order creation email notifications a little bit to better suit my needs. However there are some things I can't seem to be able to do myself.

1. The email the users get contains the date of the order, however in Hungary, we display dates differenty. How can I modify the date format in the emails?

2. I have created a custom textarea field on the order page, under the user details. The user can add a little message to the order with it. Is it possible to include the content of this custom field in the emails?

3. For the admin orders, I would like to include the unique order ids, like in the user email notification. When the user creates an order, they get the email with the subject: Your order with the id X19 has been created... but the email I get only contains the order number (19 in this case). Is it possible to show the full order ID in the admin emails?

I would be grateful if someone could help me with these problems. Thank you very much in advance!

Last edit: 11 years 3 weeks ago by jdoe.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 3 weeks ago #130442

Hi,

Are you using the new template system ?
If so, you would have to do your customization in the "preload" files. Some variables that you want to change (format for the date) are processing in this file.
For the custom field, you can display it and, be default, they are displayed in the email (order custom fields).

For the order number, it is the order id but with a different format. In the preload, you can use "order_id" instead of "order_number" if you want to id instead of the number.

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.
The following user(s) said Thank You: jdoe

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

  • Posts: 26
  • Thank you received: 0
11 years 3 weeks ago #130584

Thank you for your reply! Could you tell me where can I find the preload files?

I have edited these emails in the System > Emails menu. Here I have edited "Order administrator notification" and "Order creation notification". The second one contains the date I would like to edit. There's an h2 element which only contains the following: "{TXT:ORDER_CREATED}". The date is inside this variable. The language file contains the following for this variable:

ORDER_CREATION_SUCCESS_ON_WEBSITE_AT_DATE="We are pleased to confirm the creation of your order No. %s at %s on the %s at %s"
So I still can't edit the date here. Could you tell me where can I edit it?

The "Order administrator notification" contains the order number without the letters. The variable for it is "{VAR:ORDER_NUMBER}". I have tried changing it to order_id, but the email then displayed "{VAR:ORDER_ID}".

Well, unfortunately my custom field is not displayed in the email by default. I have created it in Display > Custom fields, published it, but it only shows up on the site, when making an order, but not in the email. How can I make it appear in the email?

Last edit: 11 years 3 weeks ago by jdoe.

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

  • Posts: 82868
  • Thank you received: 13378
  • MODERATOR
11 years 3 weeks ago #130702

Hi,

The date format can only be edited in the preload file of the email, not via the interface (yet).
You will find it in the folder media/com_hikashop/mail
Simply edit the preload file for your email there and change that line for the date format:
'ORDER_CREATED' => JText::sprintf('ORDER_CREATION_SUCCESS_ON_WEBSITE_AT_DATE', $url, HIKASHOP_LIVE, hikashop_getDate(time(),'%d %B %Y'), hikashop_getDate(time(),'%H:%M')),

Also, the order_id is not added to the $vars array of variables in that file so it's normal that you can't use it.
You would need to add such line:
$vars = $data->order_id;

Regarding the custom fields you're talking about, could you do screnshots of the options of your custom fields ?

The following user(s) said Thank You: jdoe

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

  • Posts: 26
  • Thank you received: 0
11 years 3 weeks ago #130780

Thank you, I was able to easily modify the date, and to display the full order number, I only had to edit "order_admin_notification.preload.php" on line 70 and change this:

'ORDER_NUMBER' => $data->order_id,
to this:
'ORDER_NUMBER' => $data->order_number,
So I didn't have to add a new line. Isn't it a little bug that we have came across? I think for the var 'ORDER_NUMBER', $data->order_number should be displayed by default as there is no previos reference to $data->order_id in the file.

I am attaching a picture of the options for my custom fields.

Attachments:

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

  • Posts: 12953
  • Thank you received: 1778
11 years 3 weeks ago #131079

Hi,
If you want to add your address custom field through your email, the solution will probably be to edit the "address_template" file of the "order" view of your back-end front-end template through "Hikashop->Display->Views" and add this line :

{megjegyzes}

Last edit: 11 years 3 weeks ago by Mohamed Thelji.

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

  • Posts: 26
  • Thank you received: 0
11 years 3 weeks ago #131101

I have added the line to "administrator/components/com_hikashop/views/order/tmpl/address_template.php", however unfortunately it still doesn't display nor in the admin notification, neither in the order creation notification email.

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

  • Posts: 13201
  • Thank you received: 2322
11 years 3 weeks ago #131145

Hi,

You have to add it in the view "address / address_template" of your frontend template.

The following user(s) said Thank You: jdoe

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

  • Posts: 26
  • Thank you received: 0
11 years 3 weeks ago #131181

Thank you very much, it is working now!

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

Time to create page: 0.092 seconds
Powered by Kunena Forum