FrenchMarie Posted May 14, 2021 Share Posted May 14, 2021 Hello, I am coming to you after setting up an email for addons. {foreach from=$service_custom_fields item=customfield} {$customfield} {/foreach} Cannot have the name of custom fields. We obtain : {$customfield} : {$customfield} : {$customfield} Thank you in advance for your help. 0 Quote Link to comment Share on other sites More sharing options...
steven99 Posted May 14, 2021 Share Posted May 14, 2021 If the {$customfield} is an object of WHMCS\CustomField and you would get the name via $customfield->fieldName . How does $service_custom_fields get created? 0 Quote Link to comment Share on other sites More sharing options...
FrenchMarie Posted May 17, 2021 Author Share Posted May 17, 2021 Hello, Thank you for your feedback, we have created custom fields for the product addons. For example : - Username - Password After which we created an email for sending the information. The problem we encounter in the email is that we do have the username and password, but we don't have the name of the custom field, our client will not understand. thank you in advance 0 Quote Link to comment Share on other sites More sharing options...
steven99 Posted May 17, 2021 Share Posted May 17, 2021 In the product / service email templates, you could use: {foreach from=$service_custom_fields_by_name item=customfield} {$customfield.name}: {$customfield.value} {/foreach} 0 Quote Link to comment Share on other sites More sharing options...
FrenchMarie Posted May 18, 2021 Author Share Posted May 18, 2021 Hello, Perfect, many thanks to you, it works perfectly. Do you know how to get the name of the addon in the mails. cordially 0 Quote Link to comment Share on other sites More sharing options...
steven99 Posted May 18, 2021 Share Posted May 18, 2021 Not seeing a merge field for addons so a EmailPreSend hook would be needed to get that and inject in to the template and then in the email template you use the hook's values to show the addons. I'd bet there's a hook laying around here some where for that. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.