MikkM Posted January 14, 2016 Share Posted January 14, 2016 (edited) Hi guys! I am saving some data to database with custom addons module. Later-on i want to display this info to user in clientarea, preferably in ordered product information. Here: prntscr.com/9q2lb8 Can someone point me to the right way, how could i do that? Can i display data there or will i need to create custom page? Regards Edited January 14, 2016 by Infopro Please Attach Images to Your Posts. 0 Quote Link to comment Share on other sites More sharing options...
MikkM Posted January 16, 2016 Author Share Posted January 16, 2016 Hi! I am trying to pass an array to whmcs template. I use hooks for that, i also edited template file but it wont work for some reason. I created hooks.php inside /whcms/includes/hooks <?php function hook_template_variables_example() { $extraTemplateVariables = array(); // set a fixed value $extraTemplateVariables['fixedValue'] = 'SHOW ME!!!!'; // return array of template variables to define return $extraTemplateVariables; } add_hook("ClientAreaPageProductDetails",1,"hook_template_variables_example"); ?> Then i edited template file clientareaproductdetails.tpl and added: <p>Hopefully something will appear: {$fixedValue}.</p> If i access product details in clientarea, i only see: Hopefully something will appear: So clearly nothing is passed to template, what am i doing wrong ? My test is based on this tutorial: http://docs.whmcs.com/Templates_and_Custom_PHP_Logic 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 16, 2016 Share Posted January 16, 2016 http://docs.whmcs.com/Hooks:ClientAreaPageProductDetails <?php function hook_template_variables_example() { $extraTemplateVariables = array(); // set a fixed value $extraTemplateVariables['fixedValue'] = 'SHOW ME!!!!'; // return array of template variables to define return array("fixedvalue" => $extraTemplateVariables['fixedValue'], "anothervalue" => "test"); } add_hook("ClientAreaPageProductDetails",1,"hook_template_variables_example"); ?> with the above hook, you'll pass two new variables to the products details page - {$fixedvalue} and {$anothervalue} - either can then be output wherever you want using your template edit. 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.