Email Customisation

  • Posts: 62
  • Thank you received: 0
12 years 10 months ago #20592

I would like to customise the order notification emails. I have customised the front end invoice and I would like the customer email to be of a very similar format. I would also like the administrator notification to include allot more detail, essentially to eliminate the need for my accounts team to access the backend of our website.

So with this in mind I have a couple of questions.
1. When are the following emails sent and to whom are they sent?
Order administrator notification
Order creation notification
Order status notification
Order notification
User account

2. Within these templates I see that the variable $data is used to obtain order_number, order_payment_method, order_full_price ect. Can you please point me in the direction of where this is all declared so I can get a comprehensive list of what data is available to call upon when customising the emails? For example I would like to include the coupon code, customer email and tax codes used.

Thank You

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

  • Posts: 81677
  • Thank you received: 13100
  • MODERATOR
12 years 10 months ago #20611

1.
Order administrator notification -> to the admin when the order is created
Order creation notification -> to the user when the order is created
Order status notification -> to the user when the order is confirmed
Order notification -> to the user when the admin send an email for an order from the back end
User account -> to the user when he creates a new account on HikaShop registration page/checkout page

2.
The $data comes from different places. One example is in the after_confirm function of the file components/com_hikashop/controller/checkout.php
The coupon code is in: $data->order_discount_code
The email is in: $data->customer->user_email
What do you mean by tax code ?

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

  • Posts: 62
  • Thank you received: 0
12 years 10 months ago #20777

Thankyou :) ,

By Tax codes I just meant which Tax rate was applied.
This should be ok though as I only have one and therefore if there is a Tax value then I know the tax rate.

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

  • Posts: 62
  • Thank you received: 0
12 years 10 months ago #20786

I have mostly got the Order administrator notification customised now however:

echo 'Email: '.$data->customer->user_email.' returns Email: Array

What code is required to return the email string?

I would also like the same for the customer phone number.

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

  • Posts: 81677
  • Thank you received: 13100
  • MODERATOR
12 years 10 months ago #20795

For the email you need to do like that:
echo 'Email: '.$data->customer->user_email[0];

For the phone number you can do like that:
$address = $data->order_addresses[$data->cart->billing_address->address_id];
echo 'Phone: '.$address->address_phone;

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

  • Posts: 62
  • Thank you received: 0
12 years 10 months ago #20840

echo 'Email: '.$data->customer->user_email[0];

This does not return the customers email it returns the administrator email. In other words the email to which the notification is being sent.
I would like to display the email address of the customer who bought the products.

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

  • Posts: 81677
  • Thank you received: 13100
  • MODERATOR
12 years 10 months ago #20846

Ah indeed, for the order admin notification the address receiving the email is the admin email. I thought you were editing the user emails...
For the admin email, you need to use the code:
$user = hikashop::loadUser(true);
echo $user->user_email;

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

  • Posts: 62
  • Thank you received: 0
12 years 10 months ago #20848

$user = hikashop::loadUser(true);
echo 'Email: '.$user->user_email[0];

This has returned the same result. Admin email address.

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

  • Posts: 81677
  • Thank you received: 13100
  • MODERATOR
12 years 10 months ago #20862

Mmm that's strange. The loadUser function can only return the current user information...
You could try like that:
$userCMS =& JFactory::getUser();
echo $userCMS->get('email');

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

  • Posts: 62
  • Thank you received: 0
12 years 10 months ago #21000

Thank you that worked.

All my email customisations are now complete.

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

  • Posts: 11
  • Thank you received: 0
12 years 9 months ago #23670

What file does one need to modify to add customizations to the admin order notification?'
Thanks

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

  • Posts: 81677
  • Thank you received: 13100
  • MODERATOR
12 years 9 months ago #23671

You can go in the menu System->Emails to edit your HikaShop emails (Business edition only).

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

  • Posts: 102
  • Thank you received: 0
12 years 8 months ago #25219

Nicolas, i followed this thread to add the customer's email to the admin email template. i got the same results as divine. BUT i couldnt get the last piece of code to work either.
$userCMS =& JFactory::getUser();
echo $userCMS->get('email');

returns null.

the others returned exactly what divine said. an array and then the admin email.

i am using the business edition (latest). joomla 1.5.23

can you help?

thanks liz

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

  • Posts: 81677
  • Thank you received: 13100
  • MODERATOR
12 years 8 months ago #25236

The code
$userCMS =& JFactory::getUser();
echo $userCMS->get('email');
will only return null if the user is not logged in. So I presume that it's the case ?

alternatively, you can try that:
$userClass = hiakshop_get('class.user');
$user = $userClass->get($data->order_user_id);
echo $user->user_email;

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

  • Posts: 102
  • Thank you received: 0
12 years 8 months ago #25239

hi there, thanks, this returns the following error:
Call to undefined function hiakshop_get() in /..mypathhere../media/com_hikashop/mail/order_admin_notification.html.modified.php on line 10

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

  • Posts: 81677
  • Thank you received: 13100
  • MODERATOR
12 years 8 months ago #25243

I made a typo, it's of course hikashop_get and not hiakshop_get.

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

  • Posts: 102
  • Thank you received: 0
12 years 8 months ago #25354

nicolas, with the typo fixed (i should have seen that)... it returns array.
when i dump the array it returns only one item. our email address not the customers email address.
help!
we really need this.
thanks, Liz

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

  • Posts: 81677
  • Thank you received: 13100
  • MODERATOR
12 years 8 months ago #25363

Then it must be a problem of cache. Try like that :
$userClass = hiakshop_get('class.user');
$userClass->get(false);
$user = $userClass->get($data->order_user_id);
echo $user->user_email;

That will reset the cache before loading the user information from the database.

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

  • Posts: 13
  • Thank you received: 1
12 years 8 months ago #25386

I just used this code lately..
$userClass = hikashop_get('class.user');
$userClass->get(false);
$user = $userClass->get($data->order_user_id);
echo $user->user_email;
This gotta work for u.. :)

Last edit: 12 years 5 months ago by nicolas.
The following user(s) said Thank You: huiyun

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

Time to create page: 0.117 seconds
Powered by Kunena Forum