NormanRynd Posted January 13, 2023 Share Posted January 13, 2023 Hello, i hope someone help me out with this just need to customize my fields. i have the dropdown option on my product for the Operating system to let client choose what OS The problem here windows os has a static pass "123123" so i want to custom the email if the client chooses windows he will get a message telling him this pass cause it's not dynamic i have the field build using configurable options so i want something like that ( it's not code just an example ) IF custom_field_operatingsystem = windows-server-2019 [ your password: 123123 else [ Your password : $whmcs.module.password ] can someone give me this line ? Thanks 0 Quote Link to comment Share on other sites More sharing options...
AladdinJ Posted January 13, 2023 Share Posted January 13, 2023 (edited) Hello, I have made a hook for you add_hook('EmailPreSend', 1, function($vars) { $merge_fields = []; foreach ($vars['mergefields']['service_custom_fields_by_name'] as $field) { if ($field['name'] == 'Operating system') { // consider 'Operating system' here $OperatingSystem = $field['value']; break; } } if ($OperatingSystem == "windows-server-2019") // consider "windows-server-2019" here { $merge_fields['service_password'] = "123123"; } return $merge_fields; }); consider the names of Operating system and windows-server-2019 to be as you have them on your website exactly and tell me if it worked with you Edited January 13, 2023 by AladdinJ 1 Quote Link to comment Share on other sites More sharing options...
NormanRynd Posted January 14, 2023 Author Share Posted January 14, 2023 I really appreciate your effort and spending time to help me out! thanks. but sadly it didn't work there no effect happens i made a file at /includes/hooks "Emails.php" and added a hook you provide and tried changing names small to capital,etc. but no luck so I will provide you with more screenshots of the settings you may notice something This the configurable field ( Operating system ) This field from product settings This email setting all I want if the user to choose " Window-server2019" or 2016 or 2012 it provides him the static password if not then the module will generate the password. Thanks for your effort. will wait for your answer 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.