ST4R Posted September 16, 2017 Share Posted September 16, 2017 (edited) Hi guys. I finally could add a Sidebar on viewticket page by using hooks. The Sidebar should display the Ticket ID ({$tid}), Ticket Subject ({$subject}) and the Ticket Department ({$department}). And yes, I know there's such sidebar by default but I want to add my own customized sidebar on viewticket page. As you know {$tid} works just for viewticket.tpl not hooks. How can I retrieve the mentioned variables in a hook? ({$tid}, {$subject}, {$department},..) I'm not a pro programmer, so that please give me some examples and codes. Thanks. Edited September 16, 2017 by ST4R 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 16, 2017 Share Posted September 16, 2017 https://forum.whmcs.com/showthread.php?127542-How-to-add-a-new-menu-item-in-Sidebar-on-Manage-domain&p=525913#post525913 take a look at how i'm getting the $status value from the template in the above hook - you can do the same with $tid, subject etc... GLOBAL $smarty; $status = $smarty->getVariable('tid'); 0 Quote Link to comment Share on other sites More sharing options...
ST4R Posted September 16, 2017 Author Share Posted September 16, 2017 As always, thank you Brian! it worked perfectly. - Can you please let me know what is the variable for the ticket last update? (ex. 4 days ago) - How can I translate 'days ago' part? it is not defined in language file. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 16, 2017 Share Posted September 16, 2017 - Can you please let me know what is the variable for the ticket last update? (ex. 4 days ago) add {debug} to the end of the template (viewticket.tpl) and you'll get a popup window of available Smarty variables... if it's in there, you can use it as above... if not, you may need to query the db. - How can I translate 'days ago' part? it is not defined in language file. search is always your friend... https://forum.whmcs.com/showthread.php?130985-Translate-Time-Sidebar-Recent-Tickets-and-Ticket-Information 0 Quote Link to comment Share on other sites More sharing options...
ST4R Posted September 16, 2017 Author Share Posted September 16, 2017 add {debug} to the end of the template (viewticket.tpl) and you'll get a popup window of available Smarty variables... if it's in there, you can use it as above... if not, you may need to query the db. Already did it but as you mentioned it's not in there! so I think the other way works (and I dont know how to do that, any help would be appreciated ) 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 17, 2017 Share Posted September 17, 2017 Already did it but as you mentioned it's not in there! it is in there - you just don't realise it. last updated doesn't exist as a value anywhere - it's calculated as the difference between the last reply date/time and now... how to do that calculation is shown in the above hook. granted, you can't just copy&paste the entire hook as it's setup to only work for pt_BR, but remove that condition and create a method to detect language and it will work for any language - apart from Macedonian as that isn't available to Carbon in the current WHMCS setup, but will work fine when you manually create the Macedonian translate file. if you want to see the last updated value being translated for all 26 default WHMCS languages, watch the video below - it can be done! Unable to display content. Adobe Flash is required. so I think the other way works (and I don't know how to do that, any help would be appreciated ) it's all there in the hook... you just need to take the bits you need and adjust for your purpose. 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.