d!nesh Posted October 11, 2017 Share Posted October 11, 2017 I have a create a hook on event AdminAreaViewTicketPage to grab the customfield values of all services belongs to that client. I have the array with all the values but if I return it from function, just the word "Array" is displayed in view ticket page instead of a variable in the template. I have followed the below link and also the sample code on it behaves same. https://developers.whmcs.com/themes/php/ thanks. 0 Quote Link to comment Share on other sites More sharing options...
Basheer Posted October 12, 2017 Share Posted October 12, 2017 I think AdminAreaViewTicketPage hook returns only HTML value.. https://developers.whmcs.com/hooks-reference/ticket/#adminareaviewticketpage 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Developer WHMCS Andrew Posted October 12, 2017 WHMCS Developer Share Posted October 12, 2017 Try using the hook: https://developers.whmcs.com/hooks-reference/admin-area/#AdminAreaPage 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 12, 2017 Share Posted October 12, 2017 @d!nesh what are you trying to do in the template? the Admin view ticket page is one of the few that is templated (viewticket.tpl) - so you already have direct access to the template to make any changes you wish... and you have access to the $customfields array too. ultimately, you could use the AdminAreaPage hook if you need/want to use hooks. 0 Quote Link to comment Share on other sites More sharing options...
d!nesh Posted October 12, 2017 Author Share Posted October 12, 2017 Basically, I want to display the custom fields of related service on the ticket view page. I checked the $relatedservices array in which custom fields are not included. Any suggestion on this? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 12, 2017 Share Posted October 12, 2017 have you checked the $customfields array... or even the customfields tab on the page ?? 0 Quote Link to comment Share on other sites More sharing options...
d!nesh Posted October 12, 2017 Author Share Posted October 12, 2017 27 minutes ago, brian! said: have you checked the $customfields array... or even the customfields tab on the page ?? yes, the custom field array is empty and so the message "No Custom Fields Setup for this Department" is displayed in the customfields tab. I don't have any custom field setup under the support department so its normal to have the $customfields array empty. But I have custom fields in the client services which I want to show on ticket page. 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Developer WHMCS Andrew Posted October 12, 2017 WHMCS Developer Share Posted October 12, 2017 The custom fields for a service aren't included. You'd need to obtain these. Take a look at https://developers.whmcs.com/api-reference/getclientsproducts/ for an API command that you can use to obtain the service custom fields. 0 Quote Link to comment Share on other sites More sharing options...
d!nesh Posted October 12, 2017 Author Share Posted October 12, 2017 Exactly. I already grabbed the array of client products using localAPI command GetClientsProducts but I was not able to return that array to smarty adminareaviewticketpage hook. Now, I have changed the hook to AdminAreaPage and achieved the array in template. Thanks everyone for the suggestions. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 12, 2017 Share Posted October 12, 2017 2 hours ago, d!nesh said: But I have custom fields in the client services which I want to show on ticket page. oh product custom fields... misread the question... as Andrew suggests, it's the API or a db query to get the info. 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.