Rigsby Posted May 7, 2017 Share Posted May 7, 2017 Hello... Again! : ) Please can someone let me know the hook to hide the Actions sidebar on the Choose a Domain page. Thank you 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 8, 2017 Share Posted May 8, 2017 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'); } } }); 0 Quote Link to comment Share on other sites More sharing options...
RyanWHM Posted August 13, 2020 Share Posted August 13, 2020 Hi Brian! I thank you for this hook, just what I was looking for, but 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? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 13, 2020 Share Posted August 13, 2020 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... 1 Quote Link to comment Share on other sites More sharing options...
RyanWHM Posted August 13, 2020 Share Posted August 13, 2020 You read my mind, everything is off center, I have not updated to V8 yet. Thanks so much, I will try the suggested method and revert back 🙂 0 Quote Link to comment Share on other sites More sharing options...
RyanWHM Posted August 13, 2020 Share Posted August 13, 2020 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 😄 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 13, 2020 Share Posted August 13, 2020 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"); 1 Quote Link to comment Share on other sites More sharing options...
RyanWHM Posted August 13, 2020 Share Posted August 13, 2020 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 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 13, 2020 Share Posted August 13, 2020 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. 💡 1 Quote Link to comment Share on other sites More sharing options...
RyanWHM Posted August 13, 2020 Share Posted August 13, 2020 Ah I see now, ok it is fixed, you sir are a legend! Thanks so much for helping me with this, much appreciated! 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.