Jump to content

How to add variable to smarty template


d!nesh

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.

Link to comment
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.

Link to comment
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.

 

 

Link to comment
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. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated