nandin Posted March 22, 2019 Share Posted March 22, 2019 Hello, Is it possible that someone can help me with a hook for hide a custom menu from the Store pages? Thank You 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 23, 2019 Share Posted March 23, 2019 21 hours ago, nandin said: Is it possible that someone can help me with a hook for hide a custom menu from the Store pages? which menu ? a screenshot might help. 0 Quote Link to comment Share on other sites More sharing options...
nandin Posted March 23, 2019 Author Share Posted March 23, 2019 0 Quote Link to comment Share on other sites More sharing options...
lims Posted March 24, 2019 Share Posted March 24, 2019 (edited) On 3/23/2019 at 7:21 PM, nandin said: this menu come from Setup >> MarketConnect in Manage u can manage from this ON or Off promotion Edited March 24, 2019 by lims 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 24, 2019 Share Posted March 24, 2019 if you mean that "Quick Links" sidebar, can you post the hook code that you used to create the sidebar... 13 minutes ago, lims said: this menu come from Setup >> MarketConnect in Manage does it? i've never seen that sidebar before.. 0 Quote Link to comment Share on other sites More sharing options...
lims Posted March 24, 2019 Share Posted March 24, 2019 30 minutes ago, brian! said: if you mean that "Quick Links" sidebar, can you post the hook code that you used to create the sidebar... does it? i've never seen that sidebar before.. i'm sorry for miss understand hehe, i thing this issues is marketconect, but issues is sidebar 🤣 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 24, 2019 Share Posted March 24, 2019 we'll see if/when the OP replies! there's only two menus on that screenshot - the sidebar, and the internal one within the weebly pages... it would make more sense if the sidebar was the problem because the store pages are normally full-width with no sidebars visible at all. 0 Quote Link to comment Share on other sites More sharing options...
nandin Posted March 24, 2019 Author Share Posted March 24, 2019 Hello Bryan, Below is the code I've used for the menu. It is displayed while the client is logged in, but i want to hide it from the store page to take advantage of the full width pages. <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar) { $client = Menu::context('client'); if (!is_null($client)) { $primarySidebar->addChild('quick-links', array( 'label' => 'Quick Links', 'uri' => '#', 'icon' => 'fas fa-bars', )); $quickLinksPanel = $primarySidebar->getChild('quick-links'); $quickLinksPanel->moveUp(); $quickLinksPanel->addChild('dashboard-link', array( 'uri' => '/clients/clientarea.php', 'label' => 'Dashboard', 'order' => 1, 'icon' => 'fas fa-tachometer', )); $quickLinksPanel->addChild('services-link', array( 'uri' => '/clients/clientarea.php?action=services', 'label' => 'Services', 'order' => 2, 'icon' => 'fas fa-cube', )); $quickLinksPanel->addChild('my-domains-link', array( 'uri' => '/clients/clientarea.php?action=domains', 'label' => 'Domains', 'order' => 3, 'icon' => 'fas fa-globe', )); $quickLinksPanel->addChild('billing-link', array( 'uri' => '/clients/clientarea.php?action=invoices', 'label' => 'Billing', 'order' => 4, 'icon' => 'fas fa-credit-card', )); $quickLinksPanel->addChild('email-history-link', array( 'uri' => '/clients/clientarea.php?action=emails', 'label' => 'Email History', 'order' => 5, 'icon' => 'fas fa-at', )); $quickLinksPanel->addChild('support-link', array( 'uri' => '/clients/supporttickets.php', 'label' => 'Support', 'order' => 6, 'icon' => 'fas fa-ticket-alt', )); } }); Thank you for your response 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 25, 2019 Share Posted March 25, 2019 Hi, 13 hours ago, nandin said: It is displayed while the client is logged in, but i want to hide it from the store page to take advantage of the full width pages. try the following code instead... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar) { GLOBAL $smarty; $templatefile = $smarty->getVariable('templatefile'); $client = Menu::context('client'); if (!is_null($client) && !strstr($templatefile, 'store/')) { $primarySidebar->addChild('quick-links', array( 'label' => 'Quick Links', 'icon' => 'fas fa-bars', )); $quickLinksPanel = $primarySidebar->getChild('quick-links'); $quickLinksPanel->moveUp(); $quickLinksPanel->addChild('dashboard-link', array( 'uri' => 'clientarea.php', 'label' => 'Dashboard', 'order' => 1, 'icon' => 'fas fa-tachometer', )); $quickLinksPanel->addChild('services-link', array( 'uri' => 'clientarea.php?action=services', 'label' => 'Services', 'order' => 2, 'icon' => 'fas fa-cube', )); $quickLinksPanel->addChild('my-domains-link', array( 'uri' => 'clientarea.php?action=domains', 'label' => 'Domains', 'order' => 3, 'icon' => 'fas fa-globe', )); $quickLinksPanel->addChild('billing-link', array( 'uri' => 'clientarea.php?action=invoices', 'label' => 'Billing', 'order' => 4, 'icon' => 'fas fa-credit-card', )); $quickLinksPanel->addChild('email-history-link', array( 'uri' => 'clientarea.php?action=emails', 'label' => 'Email History', 'order' => 5, 'icon' => 'fas fa-at', )); $quickLinksPanel->addChild('support-link', array( 'uri' => 'supporttickets.php', 'label' => 'Support', 'order' => 6, 'icon' => 'fas fa-ticket-alt', )); } }); ... this sidebar should only appear for clients who are logged in and NOT viewing any MarketConnect store page. 🙂 1 Quote Link to comment Share on other sites More sharing options...
lims Posted March 25, 2019 Share Posted March 25, 2019 14 hours ago, nandin said: Hello Bryan, Below is the code I've used for the menu. It is displayed while the client is logged in, but i want to hide it from the store page to take advantage of the full width pages. this problem show in homepage and 404 i just add for homepage and page 404 original source from @brian! i like him to more advanced help us original source if (!is_null($client) && !strstr($templatefile, 'store/')) add for homepage and 404 change to if (!is_null($client) && !strstr($templatefile, 'store/') && !strstr($templatefile, 'homepage') && !strstr($templatefile, 'error')) 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 25, 2019 Share Posted March 25, 2019 55 minutes ago, lims said: this problem show in homepage and 404 he didn't ask about other pages, only about the MarketConnect pages - 14th rule of fòrum replies is don't answer a question that wasn't asked! 🙂 56 minutes ago, lims said: i just add for homepage and page 404 original source to make it easier for updating, then you might use... if (!is_null($client) && !in_array($templatefile,[strstr($templatefile,'store/'),strstr($templatefile,'error/'),'homepage'])) { or if you can't use abbreviated arrays... if (!is_null($client) && !in_array($templatefile,array(strstr($templatefile,'store/'),strstr($templatefile,'error/'),'homepage'))) { ... then if he ever needed to add another page that didn't require this sidebar, he could just add it to the list... either using strstr if there are multiple variants of the page (though off-hand I can't think of any), or just the templatename if he knows what it is.... e.g if we wanted to hide the sidebar from clientareahome... if (!is_null($client) && !in_array($templatefile,array(strstr($templatefile,'store/'),strstr($templatefile,'error/'),'homepage','clientareahome'))) { 1 Quote Link to comment Share on other sites More sharing options...
nandin Posted March 27, 2019 Author Share Posted March 27, 2019 On 3/25/2019 at 12:56 PM, brian! said: Hi, try the following code instead... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar) { GLOBAL $smarty; $templatefile = $smarty->getVariable('templatefile'); $client = Menu::context('client'); if (!is_null($client) && !strstr($templatefile, 'store/')) { $primarySidebar->addChild('quick-links', array( 'label' => 'Quick Links', 'icon' => 'fas fa-bars', )); $quickLinksPanel = $primarySidebar->getChild('quick-links'); $quickLinksPanel->moveUp(); $quickLinksPanel->addChild('dashboard-link', array( 'uri' => 'clientarea.php', 'label' => 'Dashboard', 'order' => 1, 'icon' => 'fas fa-tachometer', )); $quickLinksPanel->addChild('services-link', array( 'uri' => 'clientarea.php?action=services', 'label' => 'Services', 'order' => 2, 'icon' => 'fas fa-cube', )); $quickLinksPanel->addChild('my-domains-link', array( 'uri' => 'clientarea.php?action=domains', 'label' => 'Domains', 'order' => 3, 'icon' => 'fas fa-globe', )); $quickLinksPanel->addChild('billing-link', array( 'uri' => 'clientarea.php?action=invoices', 'label' => 'Billing', 'order' => 4, 'icon' => 'fas fa-credit-card', )); $quickLinksPanel->addChild('email-history-link', array( 'uri' => 'clientarea.php?action=emails', 'label' => 'Email History', 'order' => 5, 'icon' => 'fas fa-at', )); $quickLinksPanel->addChild('support-link', array( 'uri' => 'supporttickets.php', 'label' => 'Support', 'order' => 6, 'icon' => 'fas fa-ticket-alt', )); } }); ... this sidebar should only appear for clients who are logged in and NOT viewing any MarketConnect store page. 🙂 Brain!, Your code works. Thanks you for your help. 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.