Jump to content

Way to remove cPanel related HTML from productdetails template - what is the right way?


irh

Recommended Posts

For specific service group, I need to remove the HTML that is provided by WHMCS cpanel integration:

see this screenshot:

Pasted_Image_26_4_17__2_51_pm.png

 

But I cannot find any way to achieve this. Ideally I want to use hook and avoid modifying the template files. Or alternatively specify my own template file, based on the service group ID.

 

I tried this to specify an alternative template file (even unconditionally) with no luck:

add_hook('ClientAreaPageProductDetails', 0, function($vars) {
 $vars['templatefile'] = 'clientareaproductdetailscms';
});

The template file gets ignored.

Link to comment
Share on other sites

But I cannot find any way to achieve this. Ideally I want to use hook and avoid modifying the template files. Or alternatively specify my own template file, based on the service group ID.

it's possibly worth noting the following from the documentation...

 

http://docs.whmcs.com/Working_with_Module_Templates

 

For example, in the case of the provisioning module "cpanel", /modules/servers/cpanel/overview.tpl could be customised by creating the following template file: /templates/yourtemplatename/modules/servers/cpanel/overview.tpl

so I can think of two ways to go with this - either duplicate the cpanel template folder in your own current template folder and modify the Smarty template code for your own needs... e.g add {if $pid neq 'x'} where x is the product ID of the product to hide these code blocks...

 

or if you look in the template, you'll see that those 2 blocks are within a conditional...

 

{if $systemStatus == 'Active'}

... therefore, you could use a clientareapageproductdetails hook to set $systemStatus to a different value (for specific product ID) and then the content of that conditional won't be outputted in the template.

 

you've possibly got more flexibility by editing the template rather than using the hook.

Link to comment
Share on other sites

Awesome. Could not change the value of the $systemStatus variable, I don't think it is passed by reference, but used {if $systemStatus == 'Active' and $groupname|lower neq 'groupname'} in the custom template, which does what I need.

 

Thanks heaps!!!

 

Where do I send some beer?

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