Jump to content

Remove Store dropdown menu


dosrox

Recommended Posts

Hi, 

 

I've looked all over the forums and came across alot of hooks to remove certain menu items and they worked just fine.
However, i want to remove my store drop down menu entirely. 

Is there someone that can help me with the hook? 

I've tried this so far: 

add_hook('ClientAreaNavbars', -1, function () {
    $primaryNavbar = Menu::primaryNavbar();
    $secondaryNavbar = Menu::secondaryNavbar();
    
    //remove child from primary navbar
    if ($primaryNavbar && !is_null($primaryNavbar->getChild('Store.php'))) {
        $primaryNavbar->removeChild('Store.php');
    }

Thanks in advance.

Link to comment
Share on other sites

22 hours ago, dosrox said:

However, i want to remove my store drop down menu entirely.
Is there someone that can help me with the hook? 

you can use the following hook to remove the Store menu dropdown...

<?php

# Remove Store From Navbar Hook
# Written by brian!

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)
{
	if (!is_null($primaryNavbar->getChild('Store'))) {
            $primaryNavbar->removeChild('Store');
	}
});
Link to comment
Share on other sites

On 07/03/2019 at 11:34, dosrox said:

Is there a way i can hide the dropdown menu's created on the nav bar when you're logged in?

just me in particular? lol

On 07/03/2019 at 11:34, dosrox said:

I basically want to use the navigation menu for logged out users and logged in users to be the same.

are you saying that you want users when they're logged in to still see...

hGkDYHw.png

and not...?

hPJnp12.png

if so, then you would need a primary navbar hook to delete those menus if the client is logged in, and then recreate the "loggedout" menu items... with an optional secondary navbar hook if you want to do something similar on the "Account" side of the menu.

Link to comment
Share on other sites

You're welcome anytime! haha

Basically i made a custom menu bar with hooks: Home Updates Contact Domainnames Webhosting Support.
When users log in it adds the dropdown menu's you posted above.

I just want to remove these drop down menu's: Service's, Domains, Billing, and Support.

Sorry for my lack of knowledge, very new to whmcs!

Thanks for the help!
 

Link to comment
Share on other sites

On 08/03/2019 at 13:13, dosrox said:

Basically i made a custom menu bar with hooks: Home Updates Contact Domainnames Webhosting Support.

and you want the user to see this custom menu whether they're logged in or not? if so, post your hook code - no point in me reinventing the wheel when you've done half the work! 🙂

Link to comment
Share on other sites

Right now when your not logged in users see this: https://gyazo.com/8357cd854222fb547973b57cefaf6a6e
when they are you see this: https://gyazo.com/9f96365771a7c78c8a7f015abccaa138
From the second screenshot i want to remove the dropdown menu's ( Service's, Domains, Billing and support )

I have made this menu with several hooks you posted on the forums before.

If possible, i'll make a new hook to remove these items for the logged in menu thats all i need.

 

Link to comment
Share on other sites

20 hours ago, dosrox said:

I have made this menu with several hooks you posted on the forums before.

that's the bit I was afraid of - multiple hooks all interacting with the menu at the same time... and is why I asked you to post the hook code that you had used because while it's simple for me to post the code that would remove these menus, i'm reluctant to do it for fear of causing issues down the road (e.g one hook adding menus, another hook removing them and me not knowing the order that they're running)...

but to remove those 4 items from the menu, you should just need to use the hook below...

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)
{
	$client = Menu::context('client'); 
	if (!is_null($client) && !is_null($primaryNavbar->getChild('Services'))) {
				$primaryNavbar->removeChild('Services');
	}
	if (!is_null($client) && !is_null($primaryNavbar->getChild('Domains'))) {
				$primaryNavbar->removeChild('Domains');
	}
	if (!is_null($client) && !is_null($primaryNavbar->getChild('Billing'))) {
				$primaryNavbar->removeChild('Billing');
	}
	if (!is_null($client) && !is_null($primaryNavbar->getChild('Support'))) {
				$primaryNavbar->removeChild('Support');
	}
});

there are neater ways to do it, but i've tried to keep it simple to avoid issues - at some point, you really should consolidate those hooks that are modifying the navbar into just one hook.

Link to comment
Share on other sites

Ah, i'm sorry i have alot of "small" hooks so i thought i wouldn't soam you with all the code.

Hooks are new to me as i said and i'll try yours right now i think this is exactly what i need!

Thanks for the help so far brian, apparently my posts have to be approved first so sorry for the spam!

 

Link to comment
Share on other sites

  • 1 year later...

Hi! I have a same question here, but I don't want use the whmcs store, I want to use my Wordpress site when the plans are listed and linked to addtocart on whmcs.

Ive changed the menu from navbar with hooks, but I have another buttons that show the cart with the plans from WHMCS Template (that are ugly), so I can't find a solution that show the cart with itens /cart.php?a=view - but I don't want show /cart.php plans, the same for categories...

Link to comment
Share on other sites

10 hours ago, Phill said:

Hi! I have a same question here, but I don't want use the whmcs store, I want to use my Wordpress site when the plans are listed and linked to addtocart on whmcs.

there are options - including not letting users see the front page of the cart (the one where you can choose products and/or product groups) by redirecting them elsewhere...

10 hours ago, Phill said:

Ive changed the menu from navbar with hooks, but I have another buttons that show the cart with the plans from WHMCS Template (that are ugly), so I can't find a solution that show the cart with itens /cart.php?a=view - but I don't want show /cart.php plans, the same for categories...

I might need to see what you're seeing - it sounds as though you're describing sidebars and if so, they too can be hidden with a hook - either individually or removing them all and adjusting the cart width...

Link to comment
Share on other sites

  • 1 year later...

Hi Guys, please excuse, I am new here. I would also like to remove the store option from the menu in my client area.

A contributor offered the code below, that I would like to try.  What file do I modify to include this code?

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)
{
	$client = Menu::context('client'); 
	if (!is_null($client) && !is_null($primaryNavbar->getChild('Services'))) {
				$primaryNavbar->removeChild('Services');
	}
	if (!is_null($client) && !is_null($primaryNavbar->getChild('Domains'))) {
				$primaryNavbar->removeChild('Domains');
	}
	if (!is_null($client) && !is_null($primaryNavbar->getChild('Billing'))) {
				$primaryNavbar->removeChild('Billing');
	}
	if (!is_null($client) && !is_null($primaryNavbar->getChild('Support'))) {
				$primaryNavbar->removeChild('Support');
	}
});
Link to comment
Share on other sites

  • 6 months later...
On 3/5/2019 at 8:05 AM, brian! said:

you can use the following hook to remove the Store menu dropdown...


<?php

# Remove Store From Navbar Hook
# Written by brian!

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)
{
	if (!is_null($primaryNavbar->getChild('Store'))) {
            $primaryNavbar->removeChild('Store');
	}
});

Where do i post this code?

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