Jump to content
d!nesh

How to add variable to smarty template

Recommended Posts

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.

Share this post


Link to post
Share on other sites

@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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites
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.

 

 

Share this post


Link to post
Share on other sites

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. 

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

By using this site, you agree to our Terms of Use & Guidelines