Jump to content

Displaying data in clientarea from database


MikkM

Recommended Posts

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 by Infopro
Please Attach Images to Your Posts.
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

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