Webmaster001 Posted October 28, 2013 Share Posted October 28, 2013 We have a product and it has 5 custom fields. Each of these custom fields is defined by using an input box during the checkout. When the product is created we want to send these values (which the client typed) to them for their record. WHMCS suggest using {$client_custom_fields.1} in the email template. But our clients receive empty input for those. We double checked the clients. In the Product section they have those values defined and we can see them however we are unable to see those in the sent emails. They are not encrypted by MD5 so we technically should be able to send them. Can anyone suggest how we should set up the email template so the clients receive those 5 custom field values? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 29, 2013 Share Posted October 29, 2013 because it is a custom field created within a product, I think you would use {$service_custom_fields.1} rather than {$client_custom_fields.1} 0 Quote Link to comment Share on other sites More sharing options...
Webmaster001 Posted October 29, 2013 Author Share Posted October 29, 2013 Thanks for the help. I have tried that but it has not worked yet. I tried to send the email with these 1) {$service_custom_fields.1} 2) {$service_custom_fields.2} 3) {$service_custom_fields.3} 4) {$service_custom_fields.4} 5) {$service_custom_fields.5} Also, I used this foreach function: {foreach from=$service_custom_fields item=customfield} {$customfield.name}: {$customfield.value} {/foreach} However the email contains blank fields . No output in the email. Any suggestion? 0 Quote Link to comment Share on other sites More sharing options...
Webmaster001 Posted October 29, 2013 Author Share Posted October 29, 2013 Also, in the admin dashboard I noticed for one of the clients here is the html of one of the customfields: <input type="text" name="customfield[79]" id="customfield79" value="Test Value" size="30"> I thought to share in case you can you can suggest a solution. 0 Quote Link to comment Share on other sites More sharing options...
Webmaster001 Posted October 29, 2013 Author Share Posted October 29, 2013 ok, the solution works when the product is initially created but I can't use the same technique to send the custom_fields after the initial product creation email. At least the initial suggest worked Solution: {$service_custom_fields.0} {$service_custom_fields.1} {$service_custom_fields.2} {$service_custom_fields.3} {$service_custom_fields.4} And the output was produced in the initial product email without any issue. Any suggestion why we cant send them again in an email? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 29, 2013 Share Posted October 29, 2013 that's how it worked for me when I tested it last night - purely as a welcome email when purchasing a hosting product. when you send an email (Send Email Message), I think that you can only use the merge fields shown in that page, which I think are client only. i'm not overly familiar with the mail side of WHMCS, but when sending the email, I am assuming that you are ticking the checkbox next to the clients name and hitting "Send Email Message" - this won't work as it won't have access to the product custom fields. what I think you need to do is go into the client's profile, select the product in question and then at the bottom of that page hit "Send Message" - you will then have access to the custom fields... i've tested this on mine before posting, so it should work on yours! 0 Quote Link to comment Share on other sites More sharing options...
Sive.Host Posted August 30, 2024 Share Posted August 30, 2024 You could also try: {foreach from=$service_custom_fields_by_name item=field key=index} {if $field.name == "ACTUAL NAME OF FIELD"} {$field.name} : {$field.value} {/if} {/foreach} or {foreach from=$service_custom_fields item=customfield} {$customfield} {/foreach} 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.