Jump to content

Home Page and client area navbar make different


Recommended Posts

On 20/10/2018 at 05:00, Md Zahedul Hoque said:

How to do so?

best solution would be to get a developer to do it for you... it's one of those problems that would take longer to explain the solution than it would for someone to do it.

I doubt you could do it purely with a hook, because you effectively want the default menu to be a Mega Menu, and the logged-in menu to remain as is... so that's going to require template and css changes.

Link to comment
Share on other sites

OK Great, No need MEGA Menu

Just Want to make menu as like as category

For example

Menu # Share hosting

sub menu > Linux share hosting US

                 > Windows Share hosting US 

                > Linux share hosting UK

                > Windows Share hosting UK

Menu # Re-seller hosting

sub menu > Linux Re-seller hosting US

                 > Windows Re-sellerhosting US 

                > Linux Re-seller hosting UK

                > Windows Re-seller hosting UK

 

can you please help me on this

Link to comment
Share on other sites

if you mean you want this...

6VbYNEH.png

then you could use the following hook (you'll have to change the links to match your products)...

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)
{
	$client = Menu::context('client');
	if (!$client) {	
		$primaryNavbar->addChild('Share Hosting')->setOrder(10);
			$primaryNavbar->getChild('Share Hosting')->addChild('Linux share hosting US')->setUri('cart.php?a=add&pid=1')->setOrder(1);
			$primaryNavbar->getChild('Share Hosting')->addChild('Windows Share hosting US')->setUri('cart.php?a=add&pid=2')->setOrder(2);
			$primaryNavbar->getChild('Share Hosting')->addChild('Linux share hosting UK')->setUri('cart.php?a=add&pid=3')->setOrder(3);
			$primaryNavbar->getChild('Share Hosting')->addChild('Windows Share hosting UK')->setUri('cart.php?a=add&pid=4')->setOrder(4);
			
		$primaryNavbar->addChild('Reseller Hosting')->setOrder(11);
			$primaryNavbar->getChild('Reseller Hosting')->addChild('Linux Re-seller Hosting US')->setUri('cart.php?a=add&pid=5')->setOrder(1);
			$primaryNavbar->getChild('Reseller Hosting')->addChild('Windows Re-seller Hosting US')->setUri('cart.php?a=add&pid=6')->setOrder(2);
			$primaryNavbar->getChild('Reseller Hosting')->addChild('Linux Re-seller Hosting UK')->setUri('cart.php?a=add&pid=7')->setOrder(3);
			$primaryNavbar->getChild('Reseller Hosting')->addChild('Windows Re-seller Hosting UK')->setUri('cart.php?a=add&pid=8')->setOrder(4);
	}
});

if you want them all within one menu, with individual products in a submenu, then you'd need to buy the Advanced Menu Manager to do it - you can't do it solely with hooks.

mKwUwuC.png

Link to comment
Share on other sites

Great your Hock is working If client is not login, 

The new many is not showing at clientarea its ok and great,

but problem is when clent is login and visit my home page like www.hosting121.com/pay/cart.php at that time the new hock manu is not showing.

is any way to show this menu when client is logged in and visiting  .

for your reference attached picture

 

Untitled.png

Link to comment
Share on other sites

22 hours ago, Md Zahedul Hoque said:

is any way to show this menu when client is logged in and visiting

ok I thought in your opening post, you said that you wanted the client menu to remain the same - so I deliberately didn't show these new menus to the client... however, if you want them to be shown to everyone, then you just need to remove the if statement.

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)
{
		$primaryNavbar->addChild('Share Hosting')->setOrder(10);
			$primaryNavbar->getChild('Share Hosting')->addChild('Linux share hosting US')->setUri('cart.php?a=add&pid=1')->setOrder(1);
			$primaryNavbar->getChild('Share Hosting')->addChild('Windows Share hosting US')->setUri('cart.php?a=add&pid=2')->setOrder(2);
			$primaryNavbar->getChild('Share Hosting')->addChild('Linux share hosting UK')->setUri('cart.php?a=add&pid=3')->setOrder(3);
			$primaryNavbar->getChild('Share Hosting')->addChild('Windows Share hosting UK')->setUri('cart.php?a=add&pid=4')->setOrder(4);
		$primaryNavbar->addChild('Reseller Hosting')->setOrder(11);
			$primaryNavbar->getChild('Reseller Hosting')->addChild('Linux Re-seller Hosting US')->setUri('cart.php?a=add&pid=5')->setOrder(1);
			$primaryNavbar->getChild('Reseller Hosting')->addChild('Windows Re-seller Hosting US')->setUri('cart.php?a=add&pid=6')->setOrder(2);
			$primaryNavbar->getChild('Reseller Hosting')->addChild('Linux Re-seller Hosting UK')->setUri('cart.php?a=add&pid=7')->setOrder(3);
			$primaryNavbar->getChild('Reseller Hosting')->addChild('Windows Re-seller Hosting UK')->setUri('cart.php?a=add&pid=8')->setOrder(4);
});

when the client is logged in, there are many existing links in the menu (which is another reason to assume that you didn't want to see them when logged in) - so with these new menus of yours, they may now spread over two lines...

WuqNpss.jpg

Link to comment
Share on other sites

Great ,

Actually There are 2 types of page

TYPE 1:

https://hosting121.com/pay/clientarea.php This page is after ligin a client, I Dont want to show My custom menu here. its OK

but

TYPE 2:  When client logged-in and click for " Order New service" he will redirect to https://hosting121.com/pay/index.php and https://hosting121.com/pay/card.php and so on.

I Want to show my custom menu  this pages, It should not not matter customer login in or not.

at current scenario, If client logged-in and visit https://hosting121.com/pay/card.php this page the menu is not showing custom menu. :(

Link to comment
Share on other sites

On 25/10/2018 at 17:48, Md Zahedul Hoque said:

TYPE 1:

https://hosting121.com/pay/clientarea.php This page is after login a client, I Don't want to show My custom menu here. its OK

if you don't want to show them to clients, then go back to the previous hook (if !$client).

On 25/10/2018 at 17:48, Md Zahedul Hoque said:

TYPE 2:  When client logged-in and click for " Order New service" he will redirect to https://hosting121.com/pay/index.php and https://hosting121.com/pay/card.php and so on.

I Want to show my custom menu  this pages, It should not not matter customer login in or not.

in other words, you want a link to the cart for everyone? you effectively have this in the Store dropdown.... that browse all link just takes the user to cart...

mc7rD1d.png

I suppose it could maker sense to get rid of that store link because your other dropdowns are just copy/splitting it's content.

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)
{
	$client = Menu::context('client');
	if (!$client) {	
		$primaryNavbar->addChild('Share Hosting')->setOrder(12);
			$primaryNavbar->getChild('Share Hosting')->addChild('Linux share hosting US')->setUri('cart.php?a=add&pid=1')->setOrder(1);
			$primaryNavbar->getChild('Share Hosting')->addChild('Windows Share hosting US')->setUri('cart.php?a=add&pid=2')->setOrder(2);
			$primaryNavbar->getChild('Share Hosting')->addChild('Linux share hosting UK')->setUri('cart.php?a=add&pid=3')->setOrder(3);
			$primaryNavbar->getChild('Share Hosting')->addChild('Windows Share hosting UK')->setUri('cart.php?a=add&pid=4')->setOrder(4);
			
		$primaryNavbar->addChild('Reseller Hosting')->setOrder(13);
			$primaryNavbar->getChild('Reseller Hosting')->addChild('Linux Re-seller Hosting US')->setUri('cart.php?a=add&pid=5')->setOrder(1);
			$primaryNavbar->getChild('Reseller Hosting')->addChild('Windows Re-seller Hosting US')->setUri('cart.php?a=add&pid=6')->setOrder(2);
			$primaryNavbar->getChild('Reseller Hosting')->addChild('Linux Re-seller Hosting UK')->setUri('cart.php?a=add&pid=7')->setOrder(3);
			$primaryNavbar->getChild('Reseller Hosting')->addChild('Windows Re-seller Hosting UK')->setUri('cart.php?a=add&pid=8')->setOrder(4);
	}
	if (!is_null($primaryNavbar->getChild('Store'))) {
		$primaryNavbar->removeChild('Store');
	}
		$primaryNavbar->addChild('Store')->setUri('cart.php')->setOrder(10);
});
On 25/10/2018 at 17:48, Md Zahedul Hoque said:

at current scenario, If client logged-in and visit https://hosting121.com/pay/card.php this page the menu is not showing custom menu. 😞

the above hook creates the new dropdowns for Non-Clients only... and replaces the Store link for everyone.

whilst i'm happy to help with the trickier problems, sadly i'm too busy to be writing navbar hooks for you every time you want to slightly modify your menu - you're going to need to learn the basics of modifying the menus, or buy a menu manager addon. thanks.png

Link to comment
Share on other sites

Hi,

Thanks a lot, Its help me lot, I am very much Close,

Is it possible to add "SUB Child MENU"
I have tried with this code, but its not working
$primaryNavbar->addChild('Security Tools')->setOrder(16);
$primaryNavbar->getChild('Security Tools')->addChild('Codeguard Backup')->setOrder(1);
$primaryNavbar->getChild('Security Tools')->getChild('Codeguard Backup')
->addChild('After Hours', array(
'label' => 'After Hours',
'uri' => 'afterhours.php',
'order' => '100',
));

Example

Main Menu -> Security Tools
     child menu 1 - > Codeguard Backup
          sub child menu A -> Codeguard  Plan 1
          sub child menu B-> Codeguard  Plan 1

    child menu 1 - > Wordpress Backup
        sub child menu A -> Wordpress  Plan 1
        sub child menu B-> Wordpress  Plan 1

I have attached my code, please have a look

Link to comment
Share on other sites

Hi,

Thanks a lot, Its help me lot, I am very much Close,

Is it possible to add "SUB Child MENU"
I have tried with this code, but its not working
$primaryNavbar->addChild('Security Tools')->setOrder(16);
$primaryNavbar->getChild('Security Tools')->addChild('Codeguard Backup')->setOrder(1);
$primaryNavbar->getChild('Security Tools')->getChild('Codeguard Backup')
->addChild('After Hours', array(
'label' => 'After Hours',
'uri' => 'afterhours.php',
'order' => '100',
));

Example

Main Menu -> Security Tools
     child menu 1 - > Codeguard Backup
          sub child menu A -> Codeguard  Plan 1
          sub child menu B-> Codeguard  Plan 1

    child menu 1 - > Wordpress Backup
        sub child menu A -> Wordpress  Plan 1
        sub child menu B-> Wordpress  Plan 1

I have attached my code, please have a look

menucustom.txt

Link to comment
Share on other sites

On 27/10/2018 at 16:40, Md Zahedul Hoque said:

Is it possible to add "SUB Child MENU"
I have tried with this code, but its not working

as I said in the fourth post of this thread, if you want sub menus, then you cannot do it with hooks - you will need to buy the Advanced Menu Manager addon than I mentioned previously... it creates a fake css menu that looks/behaves like the navbar menu, but allows submenus to be created. thanks.png

mKwUwuC.png

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