Jump to content

How to show client custom field in admin new order notification email?


prowebkin

Recommended Posts

I can't get hold of this. I inserted tag {$client_custom_field_myfield} into email template, but no value in email.

And this solution works in client Order Confirmation email with the same tag.

 

So how can I reach value of client custom field in admin New Order Notification template.?

Link to comment
Share on other sites

in the v5.3.14 email templates, Client custom fields are shown using {$client_customfields} in the "New Order Notification" template... it's possible that it's the same in v6.

 

I don't know if it's an array, but try it as above and if that doesn't work, put it in a foreach loop...

 

{foreach from=$client_customfields item=data}
{$data.option}: {$data.value}
{/foreach}

Link to comment
Share on other sites

in the v5.3.14 email templates, Client custom fields are shown using {$client_customfields} in the "New Order Notification" template... it's possible that it's the same in v6.

 

I don't know if it's an array, but try it as above and if that doesn't work, put it in a foreach loop...

 

{foreach from=$client_customfields item=data}
{$data.option}: {$data.value}
{/foreach}

 

Thanks, but no luck. with this code email not sending at all.

 

Tried to change variable to $client_custom_fields and use it with and without foreach and still not working.

Link to comment
Share on other sites

it might be worth reporting this as a possible bug in the Bug Reports forum.

 

it's possibly also a related bug that the client merge fields are not shown in the merge fields box for this email template - they are in v5.3

 

if you report the bug, it might be useful to include a link back to this thread in your bug post.

Link to comment
Share on other sites

Ok.

I created file my_hook.php inside includes/hook folder.

I put such code inside this file (code from devdocs):

function my_hook_for_custom_field ( $vars ) {
$merge_fields = array();
$merge_fields['my_custom_var'] = "My Custom Var";
$merge_fields['my_custom_var2'] = "My Custom Var2";
return $merge_fields;
}
add_hook( 'EmailPreSend', 1, 'my_hook_for_custom_field' );

 

and put {$my_custom_var} inside email template. And still can't see value. Where is an error?

Link to comment
Share on other sites

the code I posted in the thread below still works for me in v6.1.1... :idea:

 

http://forum.whmcs.com/showthread.php?98066-Hooks-and-or-email-merge-fields-for-custom-urls&p=409155#post409155

 

<?php

if (!defined("WHMCS"))
   die("This file cannot be accessed directly");

function hook_emailvars($vars) {

$merge_fields = array();
$merge_fields['my_custom_var'] = "My Custom Var";
$merge_fields['my_custom_var2'] = "My Custom Var2";
return $merge_fields;

}

add_hook("EmailPreSend",1,"hook_emailvars");
add_hook("EmailTplMergeFields",1,"hook_emailvars");
?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated