Jump to content

Hide / Remove the Actions sidebar on the Choose a Domain page


Rigsby

Recommended Posts

it will be a trimmed down version of the hook in the thread below - except you won't need the first IF block as you don't want to remove categories...

 

https://forum.whmcs.com/showthread.php?127390-Remove-Sidebar-Hook-on-Domain-Register&p=509898#post509898

 

so to remove it from step 2 (domains choice), you could use...

 

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaSecondarySidebar', 1, function (MenuItem $secondarySidebar) {

   if (APP::getCurrentFileName() == 'cart' && $_GET['a'] == 'add'){

       if (!is_null($secondarySidebar->getChild('Actions'))) {
                    $secondarySidebar->removeChild('Actions');
       }
   }
});

if you needed to remove it from steps 2,3,4 and 5 (domain choice, config product, config domain, view cart)...

 

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaSecondarySidebar', 1, function (MenuItem $secondarySidebar) {

   if (APP::getCurrentFileName() == 'cart' && ($_GET['a'] == 'add' or $_GET['a'] == 'confdomains' or $_GET['a'] == 'confproduct' or $_GET['a'] == 'view')){

       if (!is_null($secondarySidebar->getChild('Actions'))) {
                    $secondarySidebar->removeChild('Actions');
       }
   }
}); 

or if you wanted to use an array of pages instead...

 

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaSecondarySidebar', 1, function (MenuItem $secondarySidebar) {

   $removedpages = ['add','confproduct','confdomains','view'];

   if (APP::getCurrentFileName() == 'cart' && (in_array($_GET['a'],$removedpages))){

       if (!is_null($secondarySidebar->getChild('Actions'))) {
                    $secondarySidebar->removeChild('Actions');
       }
   }
}); 

Link to comment
Share on other sites

  • 3 years later...

Hi Ryan,

3 hours ago, RyanWHM said:

I also need to hide the categories side bar, could you perhaps assist me in adding it to the above mentioned hook for all steps so that it is hidden?

removing the categories sidebar should just require adding the code below after the similar one for actions...

    if (!is_null($secondarySidebar->getChild('Categories'))) {
                $secondarySidebar->removeChild('Categories');
    }

I should add that if you're thinking... oh i've removed the actions and categories sidebars, so surely the rest of the page should adjust its width to compensate for the missing sidebars, you'd be wrong (I don't know if this has been fixed in v8)..

if you're wanting to adjust the content to use the sidebar space, you might need to use the hook below instead...

Link to comment
Share on other sites

So this works great and hides the sidebars from the order form and centers everything nicely but it does not do anything to the domains tab , that still shows the side bar:

 

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaSecondarySidebar', 1, function (MenuItem $secondarySidebar) {

   if (APP::getCurrentFileName() == 'cart' && ($_GET['a'] == 'add' or $_GET['a'] == 'confdomains' or $_GET['a'] == 'confproduct' or $_GET['a'] == 'view')){
       
       if (!is_null($secondarySidebar->getChild('Categories'))) {
                    $secondarySidebar->removeChild('Categories');
       }
       
       if (!is_null($secondarySidebar->getChild('Actions'))) {
                    $secondarySidebar->removeChild('Actions');
       }
   }
}); 

 

I am using a slightly self modified template for the cart. What should I edit above in order to also hide and center on the domains page? (cart.php?a=add&domain=register) 

 

Thanks so much for helping me out with this 😄 

 

 

Link to comment
Share on other sites

4 minutes ago, RyanWHM said:

So this works great and hides the sidebars from the order form and centers everything nicely but it does not do anything to the domains tab , that still shows the side bar

if you're using the other hook (the css hider), then you won't need a separate sidebar hook... the CSS will hide the sidebars...

and if it's still showing on the domain register page, it might be because you haven't adjusted the hook... it includes two templates where sidebars are shown in the cart, products (opening page) and domain register... if you don't want to see sidebars on domain register, just remove it from the array.

$validtemplates = array("products");
	
Link to comment
Share on other sites

Sorry I meant to say I am using this one:

 

<?php

# Cart Sidebar Removal / Resizing Hook
# Written by brian!

function cart_remove_sidebars_hook($vars)
{    
    $validtemplates = array("products","domainregister");
    if ($vars['filename'] == "cart" && !in_array($vars['templatefile'],$validtemplates)) {
        $head_return = "<style>#order-standard_cart .pull-md-right { width:100%; }
        .sidebar {display: none;}</style>";
        return $head_return;
    }
}
add_hook("ClientAreaHeaderOutput",1,"cart_remove_sidebars_hook");

 

I removed the one previously mentioned hook. So the above mentioned hook works great but does not remove the sidebar from the domains tab

Link to comment
Share on other sites

1 minute ago, RyanWHM said:

Sorry I meant to say I am using this one:

I know. 🙂

1 minute ago, RyanWHM said:

So the above mentioned hook works great but does not remove the sidebar from the domains tab

you might want to try adjusting the $validtemplates array as I described and see what happens. 💡

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