- Posts: 45
- Thank you received: 0
Email customisation / variables we can access
15 years 5 days ago #26345
by k8fisher
Email customisation / variables we can access was created by k8fisher
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
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.
15 years 4 days ago #26365
by nicolas
Replied by nicolas on topic Re: Email customisation / variables we can access
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.
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.
15 years 3 days ago - 15 years 3 days ago #26434
by k8fisher
Replied by k8fisher on topic Re: Email customisation
Hi,
thanks for getting back to me.
Much appreciated
Kate
thanks for getting back to me.
Much appreciated
Kate
Last edit: 15 years 3 days ago by k8fisher. Reason: found item on forum with answer to my question
Please Log in or Create an account to join the conversation.
14 years 11 months ago #27535
by k8fisher
Replied by k8fisher on topic Re: Email customisation / variables we can access
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] => emailaddress@emails.co.uk
[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] =>
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] => emailaddress@emails.co.uk
[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] =>
Please Log in or Create an account to join the conversation.
14 years 11 months ago #27537
by nicolas
Replied by nicolas on topic Re: Email customisation / variables we can access
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.
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.
14 years 11 months ago #27541
by k8fisher
Replied by k8fisher on topic Re: Email customisation / variables we can access
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
I appreciate any assistance you can offer
Kate
Please Log in or Create an account to join the conversation.
14 years 11 months ago #27547
by nicolas
Replied by nicolas on topic Re: Email customisation / variables we can access
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.
$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.
14 years 11 months ago #27573
by k8fisher
Replied by k8fisher on topic Re: Email customisation / variables we can access
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
<?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.
14 years 11 months ago #27587
by nicolas
Replied by nicolas on topic Re: Email customisation / variables we can access
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;
?>
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.
14 years 11 months ago #27807
by k8fisher
Replied by k8fisher on topic Re: Email customisation / variables we can access
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
<?php
echo $user->user_mail;
?>
Many thanks
Kate
Please Log in or Create an account to join the conversation.
Time to create page: 0.247 seconds