Email customisation / variables we can access

  • Posts: 45
  • Thank you received: 0
13 years 1 month ago #26345

Hi Im trying to locate any listing of the variables we can utilise in hikashop emails.

Has anyone a sample template / list of variables which will be accessible to customise emails to clients?

I hoped there would at least be an example on the back end of the demo site to give a starting point :/

Can anyone upload a sample template just to give the forum a starting place for this sort of thing.

Kate

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

  • Posts: 82868
  • Thank you received: 13378
  • MODERATOR
13 years 1 month ago #26365

Hi,

There is no such listing.
The default emails contain already lots of variables.
If you want a full list you can add the line below in your email:

<?php echo nl2br(print_r($data,true)); ?>

Next time you receive the email, you will get the list of all the attributes of the $data variable where all the data is stored.

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

  • Posts: 45
  • Thank you received: 0
13 years 1 month ago #26434

Hi,

thanks for getting back to me.

Much appreciated

Kate

Last edit: 13 years 1 month ago by k8fisher. Reason: found item on forum with answer to my question

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

  • Posts: 45
  • Thank you received: 0
13 years 1 month ago #27535

For anyone who also wonders what variables you can access in an email from hikashop they are...

stdClass Object
(
[order_id] => 52
[old_status] => stdClass Object
(
[order_status] => created
)

[history] => stdClass Object
(
[history_reason] => automatic payment notification received
[history_notified] => 1
[history_amount] => 0.01GBP
[history_payment_id] => 1
[history_payment_method] => paypal
[history_data] =>
[history_type] => payment
)

[order_status] => confirmed
[order_modified] => 1317645439
[order_user_id] => 41
[customer] => stdClass Object
(
[user_id] => 41
[user_cms_id] => 0
[user_email] => This email address is being protected from spambots. You need JavaScript enabled to view it.
[user_partner_email] =>
[user_params] =>
[user_partner_id] => 0
[user_partner_price] => 0.00000
[user_partner_paid] => 0
[user_created_ip] => 83.244.197.114
[user_unpaid_amount] => 0.00000
[user_partner_currency_id] => 0
[user_created] => 1317373647
[user_currency_id] => 0
[user_partner_activated] => 0
[id] =>
[name] =>
[username] =>
=> [password] => [usertype] => [block] => [sendEmail] => [gid] => [registerDate] => [lastvisitDate] => [activation] => [params] => ) [order_url] => http://xxx.co.uk/index.php?option=com_hikashop&ctrl=order&task=show&cid[]=52&Itemid=69 [mail_status] => confirmed. )[email] =>
[password] =>
[usertype] =>
[block] =>
[sendEmail] =>
[gid] =>
[registerDate] =>
[lastvisitDate] =>
[activation] =>
[params] =>
)

[order_url] => xxx.co.uk/index.php?option=com_hikashop&...=order&task=show&cid []=52&Itemid=69
[mail_status] => confirmed.
)

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

  • Posts: 82868
  • Thank you received: 13378
  • MODERATOR
13 years 1 month ago #27537

That's just for the order status notification.

For each email you will have different things in $data. That's why I gave you the code above to get the information yourself in the email you need to change.

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

  • Posts: 45
  • Thank you received: 0
13 years 1 month ago #27541

Can I ask as I seem to be able to access some of these values but *not* others *how* do I reference the customers email address. I only ask as previous experiments have even managed to stop customer emails going out.

I appreciate any assistance you can offer

Kate

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

  • Posts: 82868
  • Thank you received: 13378
  • MODERATOR
13 years 1 month ago #27547

The customer email which is used to send the email is in the variable:
$mail->dst_email
The $data variable contains information to be displayed in the email.
The $mail variable contains the data of the email itself.

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

  • Posts: 45
  • Thank you received: 0
13 years 1 month ago #27573

Just to confirm what would the code I put look like? Ive tried...

<?php echo $mail->dst_email ?>

but this doesnt print out the email address is there something else which should appear in the command?

Kate

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

  • Posts: 82868
  • Thank you received: 13378
  • MODERATOR
13 years 1 month ago #27587

For which email are you trying to echo the email ?
As you can see from the name of the variable, that displays the email of the receiver of the email. It will not work in the admin email as that is an array of emails and it does not contain the customer email since the receiver is the admin, not the customer.
In that case, you would have to load the info of the user like that:
<?php
$class = hikashop_get('class.user');
$user = $class->get($data->cart->order_user_id);
echo $user->user_mail;
?>

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

  • Posts: 45
  • Thank you received: 0
13 years 1 month ago #27807

Hi Im trying to add the customers email address to the body of the email actually, so woudl I go straight with...

<?php
echo $user->user_mail;
?>

Many thanks

Kate

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

Time to create page: 0.054 seconds
Powered by Kunena Forum