Jump to content

Add sidebar menu


Tom Wilson

Recommended Posts

4 hours ago, Tom Wilson said:

I want to add an option under 'Manage' which will link to another page - how do I do this?

as a rough starting point...

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar)
{
	$DomainDetails = $primarySidebar->getChild("Domain Details Management");
	if (empty($DomainDetails)) {
		return;
	}
	$DomainDetails->addChild('new link 5', array(
                'label' => '*My Label*',
                'uri' => 'custompage.php',
                'order' => '100',
            ));
});

hL8J7f1.png

you could use Lang::trans on the label if it needs to be multilingual and you want to create the language strings for it; the 'order' value will determine where it is located on the sidebar (lower values towards the top, higher values towards the bottom); and 'uri' contains the page that you want the child to link to.

Link to comment
Share on other sites

On 25/08/2019 at 5:02 PM, brian! said:

as a rough starting point...


<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar)
{
	$DomainDetails = $primarySidebar->getChild("Domain Details Management");
	if (empty($DomainDetails)) {
		return;
	}
	$DomainDetails->addChild('new link 5', array(
                'label' => '*My Label*',
                'uri' => 'custompage.php',
                'order' => '100',
            ));
});

hL8J7f1.png

you could use Lang::trans on the label if it needs to be multilingual and you want to create the language strings for it; the 'order' value will determine where it is located on the sidebar (lower values towards the top, higher values towards the bottom); and 'uri' contains the page that you want the child to link to.

Thanks!

 

How about a page for a web hosting product too? On this one, I would like to not only add one, but remove one too, I am wanting to remove the 'Request Cancellation' and 'Upgrade/Downgrade Options'.

 

Link to comment
Share on other sites

6 minutes ago, Tom Wilson said:

How about a page for a web hosting product too? On this one, I would like to not only add one, but remove one too, I am wanting to remove the 'Request Cancellation' and 'Upgrade/Downgrade Options'.

Hello

Setup>General Settings>other

There is an option built in to disable cancellation. try and see if it works, regarding upgrade and downgrade, i cant remember...

image.png.474c65a454b5c569d1e0bc9f64cc79ff.png

Link to comment
Share on other sites

11 minutes ago, Tom Wilson said:

How about a page for a web hosting product too?

11 minutes ago, Tom Wilson said:

On this one, I would like to not only add one, but remove one too, I am wanting to remove the 'Request Cancellation' and 'Upgrade/Downgrade Options'.

$kidsToIcon = array("Upgrade/Downgrade","Cancel");
1 minute ago, zitu4life said:

regarding upgrade and downgrade, i cant remember...

it's in the product setup for each product.. setup -> product/services -> product/services -> *choose product* -> upgrades -> untick Configurable Options checkbox.

if you're wanting to remove both cancellation and config upgrades on all products, then you can use either method... if you want to remove them for specific products, then you'll need the hook.

and with regards to adding a child..

$ActionDetails->addChild('new link 6', array(
                'label' => '*My Label*',
                'uri' => 'custompage.php',
                'order' => '100',
            ));
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